<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Query7 &#187; jquery</title>
	<atom:link href="http://query7.com/category/jquery/feed" rel="self" type="application/rss+xml" />
	<link>http://query7.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Fri, 09 Apr 2010 09:36:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Codemirror &#8211; javascript syntax highlighting</title>
		<link>http://query7.com/codemirror-javascript-syntax-highlighting</link>
		<comments>http://query7.com/codemirror-javascript-syntax-highlighting#comments</comments>
		<pubDate>Wed, 22 Jul 2009 21:05:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://query7.com/?p=512</guid>
		<description><![CDATA[<p><a href="http://marijn.haverbeke.nl/codemirror/">CodeMirror</a> is an on the fly syntax highlighting engine, written in Javascript. Like CodePress (the syntax highlighter used in the latest version of wordpress for editing plugins), it can highlight many different languages (PHP, JS, HTML, CSS to name a&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://marijn.haverbeke.nl/codemirror/">CodeMirror</a> is an on the fly syntax highlighting engine, written in Javascript. Like CodePress (the syntax highlighter used in the latest version of wordpress for editing plugins), it can highlight many different languages (PHP, JS, HTML, CSS to name a few). This tutorial will show you how to implement CodeMirror on your site, there is a great article written by the author of this library <a href="http://marijn.haverbeke.nl/codemirror/story.html">here</a> on how it works under the hood.</p>
<h3>Installation</h3>
<p>Download the latest version from the CodeMirror <a href="http://marijn.haverbeke.nl/codemirror/">website</a>. As of today, it is version 0.62. After you unzip it you will see 3 directories &#8211; <em>js</em>, <em>css</em> and <em>contrib</em>. <em>contrib</em> holds parsers that other people have written such as the lua, python and PHP. <em>css</em> holds the color schemes for syntax highlighting and <em>js</em> contains the necessary scripts for CodeMirror to run.</p>
<h3>Basic Usage</h3>
<p>If we have a textarea with an id of code that we wanted to turn into a CodeMirror editor with a MirrorFrame(more on this later) then we would use the code below. Note that we need to specify where the parserfiles and stylesheets for the particular type of syntax (in this case javascript) are located.</p>
<pre>
  var textarea = document.getElementById('code');
  var editor = new MirrorFrame(CodeMirror.replace(textarea), {
    height: "350px",
    content: textarea.value,
    parserfile: ["tokenizejavascript.js", "parsejavascript.js"],
    stylesheet: "css/jscolors.css",
    path: "js/",
    autoMatchParens: true
  });
</pre>
<p>The result would be:<br />
<img src="http://query7.com/wp-content/uploads/2009/07/default1.png" alt="default1" title="default1" width="565" height="367" class="alignnone size-full wp-image-517" /></p>
<h3>MirrorFrame</h3>
<p>The MirrorFrame class extends the syntax highlighter and makes the editor feel more of a true editor &#8211; with a toolbar/buttons. You can find the source of the MirrorFrame implementation in <em>js/mirrorframe.js</em>. As an example we&#8217;ll take the &#8216;get current line number&#8217; function. It references <em>this</em> which in our case is the current editor. There are alot of functions CodeMirror makes available (<a href="http://marijn.haverbeke.nl/codemirror/manual.html#programming">list here</a>), you can write your own functions and attach them to a button in your own MirrorFrame editor.</p>
<pre>
  line: function() {
    alert("The cursor is currently at line " + this.mirror.currentLine());
    this.mirror.focus();
  },
</pre>
<h3>CodeMirror</h3>
<p>We can pass many configuration options to the CodeMirror class when we instantiate it such as whether we want line numbering and the size of tab width. An example below:</p>
<pre>
editor = CodeMirror.fromTextArea(textarea, {
content: textarea.value,
parserfile: ["parser/tokenizejavascript.js", "parser/parsejavascript.js"],
stylesheet: "css/editor_colours/jscolours.css",
path: "js/",
autoMatchParens: true,
width: '100%',
height: '100%',
textWrapping: false,
lineNumbers: true,
tabMode: 'spaces',
iframeClass: 'ifc',
indentUnit: 4
});
</pre>
<p><img src="http://query7.com/wp-content/uploads/2009/07/custom.png" alt="custom" title="custom" width="435" height="321" class="alignnone size-full wp-image-528" /></p>
<p>There are also 2 events available for the developer to use. <em>onChange</em> and <em>initCallBack</em>. initCallBack is called when the editor has loaded and is ready for the user to start entering code (remember an iframe is created, additional javascript files are loaded). onChange occurs whenever a change is made in the editor itself. If we wanted to build an on-the-fly code tester, and needed to fetch the code from the editor whenever the code in the editor changed, then we would do the following:</p>
<pre>
  var editor = CodeMirror.fromTextArea(textarea, {
    height: "350px",
    content: textarea.value,
    parserfile: ["tokenizejavascript.js", "parsejavascript.js"],
    stylesheet: "css/jscolors.css",
    path: "js/",
    autoMatchParens: true,
    onChange: function (n) { alert(editor.getCode()); },
  });
</pre>
<p><img src="http://query7.com/wp-content/uploads/2009/07/alert1.png" alt="alert1" title="alert1" width="626" height="354" class="alignnone size-full wp-image-531" /></p>
<p>This was just a quick look at CodeMirror, but hopefully you can appreciate just how powerful it is. It could be used in your website&#8217;s admin interface to alter code on the fly, or be used in <a href="http://www.appcelerator.com/">Titanium</a> or <a href="http://www.adobe.com/products/air/">AIR</a> to create a desktop IDE in HTML/Javascript.</p>
]]></content:encoded>
			<wfw:commentRss>http://query7.com/codemirror-javascript-syntax-highlighting/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Other jQuery Uses</title>
		<link>http://query7.com/other-jquery-uses</link>
		<comments>http://query7.com/other-jquery-uses#comments</comments>
		<pubDate>Mon, 19 Jan 2009 20:32:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://query7.com/?p=332</guid>
		<description><![CDATA[<p>We traditionally think that jQuery&#8217;s selector engine can only select elements/information off of the document that we are working on. And AJAX&#8217;s only use is to process web forms without the page needing to reload. While both of these are&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>We traditionally think that jQuery&#8217;s selector engine can only select elements/information off of the document that we are working on. And AJAX&#8217;s only use is to process web forms without the page needing to reload. While both of these are common uses, they are not the only uses. In this tutorial I&#8217;m going to show you a not-so-mainstream use of jQuery, but a very useful one all the same.</p>
<p>Take this standard web page. It pulls the latest news items from a database and displays them like so. That is the basic DOM of the page.</p>
<pre>&lt;head&gt;
&lt;title&gt;Latest News&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;

# More Header, sidebar code here #

&lt;p class="latest"&gt;Employees at the Karate Bank are getting the chop&lt;/p&gt;
&lt;p class="latest"&gt;NASA shares have sky-rocketed&lt;/p&gt;
&lt;p class="latest"&gt;Investors at the Sushi Bank feel they are getting a raw deal&lt;/p&gt;

# More content, footer code here #

&lt;/body&gt;

&lt;/html&gt;
&lt;/pre&gt;</pre>
<p>If we wanted to highlight all of the news items on this page we can use jQuery&#8217;s each method to iterate through them and modify their CSS.</p>
<pre>$("p.latest").each(function(){

	$(this).css({"background-color" : "yellow"});

});</pre>
<p>But what if we wanted to pull that information from another page? Due to some restrictions in the software the website is using, mayby they can&#8217;t display the latest posts on every page that they want to. To get this information we would need to do 2 things. The first is to pull the latest news page itselfand the second is to parse that page and only show the latest news (not the header, sidebar etc.)</p>
<h3>Ajax</h3>
<p>First of all we want to pull the page using AJAX and save it in a variable. To do this we use jQuery&#8217;s $.get method. We specify the page and since we are not sending any data (like information from a form) we don&#8217;t need to specify anything else. We then save the contents of latestnews.html into the variable content. This is important.</p>
<pre>$.get('http://urlto.com/latestnews.html' ,function(content) {

});</pre>
<h3>Narrowing Our Search</h3>
<p>At this stage we cannot simply document.write(content) as it contains all of the header, footer, sidebar and text in there. We need to select the latest news paragraphs that we want. For this we use jQuery&#8217;s standard selector. We don&#8217;t need to use a special plugin or write our own function. The only thing we need to change is to pass an extra parameter into the selector. This parameter tells jQuery&#8217;s selector engine where it look for the pattern/rule. If it isn&#8217;t specified (it usually isn&#8217;t in standard codes) then jQuery assumes you mean the current page&#8217;s source (DOM) however by specifying this we can narrow our search. In the code below we pass the content variable (which contains the entire source of latestnews.html) into the selector. jQuery will then look for all paragraphs with a class of latest inside the content variable.</p>
<pre>$.get('http://urlto.com/latestnews.html' ,function(content) {

$("p.latest", content).each(function(){

});

});</pre>
<h3>Displaying the data</h3>
<p>Since we have matched the URLs, we can display the content as we please.<br />
If we wanted to highlight the latest news paragraphs on that page then we would:</p>
<pre>$.get('http://urlto.com/latestnews.html' ,function(content) {

$("p.latest", content).each(function(){

$(this).appendTo("#latest");

});

});</pre>
<h3>More</h3>
<p>Using the information you&#8217;ve learnt, you can apply this to other situations. For example you can parse RSS feeds and reflect live updates of the RSS feed on the website straight away. These techniques are especially useful in remotely hosted software systems where you have no control over the source code. Or if PHP coding isn&#8217;t your strong point, but you know a little bit of jQuery, you can easily modify some of your website content this way.</p>
]]></content:encoded>
			<wfw:commentRss>http://query7.com/other-jquery-uses/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Increase Development Speed With jQuery</title>
		<link>http://query7.com/increase-development-speed-with-jquery</link>
		<comments>http://query7.com/increase-development-speed-with-jquery#comments</comments>
		<pubDate>Wed, 24 Dec 2008 06:23:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://query7.com/?p=299</guid>
		<description><![CDATA[<p>As we all know jQuery is a very small language. Not only is the file size of the jQuery library small, but the amount of code you need to write to achieve something is also very small. Because of this&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>As we all know jQuery is a very small language. Not only is the file size of the jQuery library small, but the amount of code you need to write to achieve something is also very small. Because of this it is sometimes more efficient to write and test jQuery code in the browser than in a local file. To do this we need a couple of things.</p>
<ol>
<li>The Firebug Extension for Firefox</li>
<li>Greasemonkey</li>
</ol>
<p>If the page that we are going to manipulate doesn&#8217;t already include jQuery on it, then we can include it with this small Greasemonkey script. If jQuery is already included on the page, there is no use for this script.</p>
<pre><code>// Add jQuery
    var GM_JQ = document.createElement('script');
    GM_JQ.src = 'http://jquery.com/src/jquery-latest.js';
    GM_JQ.type = 'text/javascript';
    document.getElementsByTagName('head')[0].appendChild(GM_JQ);

// Check if jQuery's loaded
    function GM_wait() {
        if(typeof unsafeWindow.jQuery == 'undefined') { window.setTimeout(GM_wait,100); }
    else { $ = unsafeWindow.jQuery; letsJQuery(); }
    }
    GM_wait();

// All your GM code must be inside this function
    function letsJQuery() {
        alert($); // check if the dollar (jquery) function works

    }
</code></pre>
<p><a href="http://joanpiedra.com/jquery/greasemonkey/">Source</a><br />
With the jQuery library on the page we can now go ahead and start entering commands. For this example we&#8217;ll take jQuery.com, we can enter a basic jQuery Selector and see what happens.</p>
<p>before.png (http://img228.imageshack.us/img228/1918/beforeus0.png) Download, rehost, embed this image here.</p>
<p>after.png (http://img218.imageshack.us/img218/5812/aftercd6.png) Download, rehost, embed this image here.</p>
<p>As you can see it&#8217;s very easy to manipulate pages. You can use this to manipulate scripts that your working on. For example, if you were trying to nail down a certain selector, or find a 4th parent of something, its going to be alot easier and faster to do it in the Firebug terminal than editing, saving and refreshing the page while your trying to perfect it. With jQuery&#8217;s CSS capabilities, you can also test your CSS out live, without needing to switch back and forth between your editor and firefox.</p>
]]></content:encoded>
			<wfw:commentRss>http://query7.com/increase-development-speed-with-jquery/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP/jQuery Todo List Part 2</title>
		<link>http://query7.com/php-jquery-todo-list-part-2</link>
		<comments>http://query7.com/php-jquery-todo-list-part-2#comments</comments>
		<pubDate>Mon, 08 Dec 2008 04:24:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jquery]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://query7.com/?p=280</guid>
		<description><![CDATA[<p>This is part 2 of a 2 part series on making a Todo List with PHP and enhancing it with jQuery&#8217;s AJAX</p>
<p>In part 1 of the tutorial, we covered the PHP and MySQL side of things. In this part&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>This is part 2 of a 2 part series on making a Todo List with PHP and enhancing it with jQuery&#8217;s AJAX</p>
<p>In part 1 of the tutorial, we covered the PHP and MySQL side of things. In this part we will be enhancing it with jQuery&#8217;s AJAX and manipulation functionality. The to-do list will degrade fine &#8211; if the user has Javascript disabled, the application will still work. All changes occur in the <strong>index.php</strong> file.</p>
<p>There are two parts to the script. One handles the posting of new posts, while the other handles posts being deleted. We&#8217;ll start with adding new posts.</p>
<pre>//When the button with an id of submit is clicked (the submit button)
$("#submit").click(function(){

//Retrieve the contents of the textarea (the content)
var formvalue = $("#content").val();

//Build the URL that we will send
var url = 'submit=1&amp;content=' + formvalue;

//Use jQuery's ajax function to send it
 $.ajax({
   type: "POST",
   url: "process.php",
   data: url,
   success: function(){

//If successful , notify the user that it was added
   $("ul").before("&lt;p class='new'&gt;You just added: &lt;i&gt;" + formvalue + "&lt;/i&gt;&lt;/p&gt;");

   }
 });

//We return false so when the button is clicked, it doesn't follow the action
return false;

});</pre>
<p>The <em>url</em> part confuses some people. What we are doing is sending a request to the process page, we need to include some data with that request. In process.php there was the line</p>
<pre>if($_POST['submit']){</pre>
<p>It checks to see if $_POST['submit'] isn&#8217;t null (has a value). If it is null (has no value), then it means that the form hadn&#8217;t been submitted, by sending any value, in our case <em>submit=1</em>, we are telling process.php that the button had been clicked so it should run the rest of the PHP script. The rest of the PHP script calls for the content, which we also send in the url (<em>content= &#8216; + formvalue</em>). Instead of sending anything, we only want to send the value of the form (The stuff inside the textarea &#8211; that the user wants to submit). By returning false at the end, it prevents the submit button from carrying through with its <em>action=&#8221;process.php&#8221;</em>. If it did, it means the page would refresh when the information was sent which is exactly what we don&#8217;t want.</p>
<p>The code that handles the deletion of posts is similar.</p>
<pre>//Check to see if an anchor link was clicked (The delete link)
$("a").click(function(){

//Save the link in a variable called element
var element = $(this);

//Find the id of the link that was clicked
var noteid = element.attr("id");

//Built a url to send
var info = 'id=' + noteid;

 $.ajax({
   type: "GET",
   url: "delete.php",
   data: info,
   success: function(){
   element.parent().eq(0).fadeOut("slow");
   }
 });

//We return false so the browser doesn't actually follow the link
return false;

});</pre>
<p>When we were displaying the posts in <strong>process.php</strong> we echo&#8217;d the id of the post in the anchor tag. We are then getting this id <em>element.attr(&#8220;id&#8221;)</em> and building the URL. So when the AJAX call is sent, it will be something like <em>delete.php?id=POSTID. </em>If the AJAX call is successful, then we need to hide the list item.</p>
<pre>element.parent().eq(0).fadeOut("slow");</pre>
<p>In that bit of code, we select the element (anchor tag) that was clicked. We then find it&#8217;s parents and take the first one using <em>eq(0)</em>. It&#8217;s &#8216;first&#8217; parent is the list item its in (&lt;li&gt;&lt;a href&gt;&lt;/a&gt;&lt;/li&gt;) and we fade that out slowly.</p>
<p>Demo: <a href="http://lastkarrde.com/q7todo/">http://lastkarrde.com/q7todo/</a></p>
<p>Download: <a href="http://lastkarrde.com/files/q7todo.zip">http://lastkarrde.com/files/q7todo.zip</a></p>
<p>You can read the first part of the series at <a href="http://query7.com/php-jquery-todo-list-part-1/">PHP + jQuery Todo List Part 1</a></p>
]]></content:encoded>
			<wfw:commentRss>http://query7.com/php-jquery-todo-list-part-2/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>PHP + jQuery Todo List Part 1</title>
		<link>http://query7.com/php-jquery-todo-list-part-1</link>
		<comments>http://query7.com/php-jquery-todo-list-part-1#comments</comments>
		<pubDate>Wed, 03 Dec 2008 15:54:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jquery]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://query7.com/?p=270</guid>
		<description><![CDATA[<p>This is part 1 of a 2 part series on making a Todo List with PHP and enhancing it with jQuery&#8217;s AJAX</p>
<p>In this two part series I&#8217;m going to show you how to make a simple to-do list in&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>This is part 1 of a 2 part series on making a Todo List with PHP and enhancing it with jQuery&#8217;s AJAX</p>
<p>In this two part series I&#8217;m going to show you how to make a simple to-do list in PHP, and then enhance it using jQuery&#8217;s AJAX and manipulation capabilities. This won&#8217;t follow any proper coding principles, but will give you the skills to adapt the code to fit your own situations. A todo list isn&#8217;t that far away from a simple threaded forum.</p>
<p>It will consist of a few files.</p>
<ul>
<li>delete.php &#8211; delete the note.</li>
<li>process.php &#8211; create the note, display the notes.</li>
<li>index.html &#8211; form, javascript</li>
</ul>
<p>We will be storing the list items in a MySQL database. The query:</p>
<pre>CREATE TABLE `notes`
(
`id` INT PRIMARY KEY AUTO INCREMENT NOT NULL,
`content` VARCHAR(500) NOT NULL
)</pre>
<p><strong>index.php</strong> will only contain the form (for now). It&#8217;s a fairly basic form, it contains a textarea (where the user enters their note) and a button they hit to submit it. The information is sent to a file called process.php through the post method.</p>
<pre>&lt;form id="form" action="process.php" method="post"&gt;
&lt;textarea name="content" id="content" cols="50" rows="3"&gt;&lt;/textarea&gt;
&lt;input type="submit" id="submit" name="submit" value="Post it" /&gt;
&lt;/form&gt;</pre>
<p><strong>process.php</strong> then handles the information that was sent from the form. We only need to insert the content into the database because the <em>id</em> field auto_increments itself. We display the to-do list in a nice and tidy list. We also provide a link after the post to delete it.</p>
<pre>&lt;?php
//Connect to the database
$connection = mysql_connect('host (usually localhost)', 'mysql_username' , 'mysql_password');
$selection = mysql_select_db('mysql_database', $connection);

//Was the form submitted?
if($_POST['submit']){

//Map the content that was sent by the form a variable. Not necessary but it keeps things tidy.
$content = $_POST['content'];

//Insert the content into database
$ins = mysql_query("INSERT INTO `notes` (content) VALUES ('$content')");

//Redirect the user back to the index page
header("Location:index.php");
}

/*Doesn't matter if the form has been posted or not, show the latest posts*/

//Find all the notes in the database and order them in a descending order (latest post first).
$find = mysql_query("SELECT * FROM `notes` ORDER BY id DESC");

//Setup the un-ordered list
echo '&lt;ul&gt;';

//Continue looping through all of them
while($row = mysql_fetch_array($find)){

//For each one, echo a list item giving a link to the delete page with it's id.
echo '&lt;li&gt;' . $row['content'] . ' &lt;a id="' . $row['id'] . '" href="delete.php?id=' . $row['id'] . '"&gt;&lt;img src="cancel.png" alt="Delete?" /&gt;&lt;/a&gt;&lt;/li&gt;';

}

//End the un-ordered list
echo '&lt;/ul&gt;';

?&gt;</pre>
<p><strong>delete.php</strong> does nothing more than delete the post. It uses the id parameter its provided to find the post entry in the database. Once it&#8217;s found, it&#8217;s deleted.</p>
<pre>&lt;?php

//Connect to the database
$connection = mysql_connect('host (usually localhost)', 'mysql_username' , 'mysql_password');
$selection = mysql_select_db('mysql_database', $connection);

//delete.php?id=IdOfPost
if($_GET['id']){

$id = $_GET['id'];

//Delete the record of the post
$delete = mysql_query("DELETE FROM `notes` WHERE `id` = '$id'");

//Redirect the user
header("Location:index.php");

}

?&gt;</pre>
<p>All of this produces a tidy to-do system. The source, stylesheet and images will be provided in a .zip file at the end of Part 2 of this tutorial.</p>
<p>You can read the second part of the series at <a href="http://query7.com/php-jquery-todo-list-part-2/">PHP/jQuery Todo List Part 2</a></p>
]]></content:encoded>
			<wfw:commentRss>http://query7.com/php-jquery-todo-list-part-1/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>jQuery In Action</title>
		<link>http://query7.com/jquery-in-action</link>
		<comments>http://query7.com/jquery-in-action#comments</comments>
		<pubDate>Thu, 20 Nov 2008 10:30:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.query7.com/?p=129</guid>
		<description><![CDATA[<p>In an attempt to sharpen up my jQuery, i purchased the book <a href="http://www.amazon.com/gp/product/1933988355?ie=UTF8&#38;tag=query7com-20&#38;linkCode=as2&#38;camp=1789&#38;creative=9325&#38;creativeASIN=1933988355">jQuery in Action</a><img style="border:none !important; margin:0px !important;" src="http://www.assoc-amazon.com/e/ir?t=query7com-20&#38;l=as2&#38;o=1&#38;a=1933988355" border="0" alt="" width="1" height="1" /> by Bear Bibeault and Yehuda Katz. Reading through the book, i could see that the first few chapters were obviously aimed at beginners. They&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>In an attempt to sharpen up my jQuery, i purchased the book <a href="http://www.amazon.com/gp/product/1933988355?ie=UTF8&amp;tag=query7com-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=1933988355">jQuery in Action</a><img style="border:none !important; margin:0px !important;" src="http://www.assoc-amazon.com/e/ir?t=query7com-20&amp;l=as2&amp;o=1&amp;a=1933988355" border="0" alt="" width="1" height="1" /> by Bear Bibeault and Yehuda Katz. Reading through the book, i could see that the first few chapters were obviously aimed at beginners. They covered selectors (If you know CSS already your fine) and events. You can easily get this information off the jQuery doc site, nothing spectacular there. Chapter 5 covers the effects, slides and fades but goes into depth abit more on the animate function. Something (in my opinion) which is under documented on the jQuery doc site. It shows off a few different examples.</p>
<p>Chapter 7 is another excellent chapter &#8211; showing you how to write your own plugins. It goes into alot of detail, from extending the wrapper to proper naming conventions to looping through each element effected. This chapter is a must read for anyone considering writing their own jQuery plugins. Again, the authors have written 3 example plugins providing alot of reference material.</p>
]]></content:encoded>
			<wfw:commentRss>http://query7.com/jquery-in-action/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More jQuery Effects</title>
		<link>http://query7.com/more-jquery-effects</link>
		<comments>http://query7.com/more-jquery-effects#comments</comments>
		<pubDate>Thu, 20 Nov 2008 10:27:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.query7.com/?p=58</guid>
		<description><![CDATA[<p>With the arrival of jQuery UI 1.5 i was browsing its&#8217; wiki pages and learning all of the API. I came across the jQuery UI wiki page, its essentially more jQuery effects except these ones are alot more dynamic! You&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>With the arrival of jQuery UI 1.5 i was browsing its&#8217; wiki pages and learning all of the API. I came across the jQuery UI wiki page, its essentially more jQuery effects except these ones are alot more dynamic! You can explode, puff, slide, highlight and alot more. I was a amazed that i hadn&#8217;t seen this page or been linked to it before, its something the jQuery UI team should be proud of.</p>
<p><a href="http://docs.jquery.com/UI/Effects">Check it out</a></p>
]]></content:encoded>
			<wfw:commentRss>http://query7.com/more-jquery-effects/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery UI</title>
		<link>http://query7.com/jquery-ui</link>
		<comments>http://query7.com/jquery-ui#comments</comments>
		<pubDate>Thu, 20 Nov 2008 10:26:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.query7.com/?p=55</guid>
		<description><![CDATA[<p>For those of you with no jQuery background what-so-ever, jQuery UI is a series of user interface (UI) enhancements made in Javascript. These range from tabs (which also support ajax loading), to dialog boxes which you can drag, drop and&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>For those of you with no jQuery background what-so-ever, jQuery UI is a series of user interface (UI) enhancements made in Javascript. These range from tabs (which also support ajax loading), to dialog boxes which you can drag, drop and resize. All cross browser! Although its currently still under development the finish line is in sight for the 1.5 release. I encourage everyone to check it out, it can add some really professional effects to your website for minimal lines of code.</p>
]]></content:encoded>
			<wfw:commentRss>http://query7.com/jquery-ui/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Menu Roundup</title>
		<link>http://query7.com/jquery-menu-roundup</link>
		<comments>http://query7.com/jquery-menu-roundup#comments</comments>
		<pubDate>Wed, 19 Nov 2008 23:27:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://query7.com/?p=225</guid>
		<description><![CDATA[<p><span>“Whats a good jQuery menu?” is a question I hear quite frequently on blogs and forums. As jQuery is such a simple language to learn, most people code their own for their own sites. I’ve compiled a list of 3</span>&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p><span>“Whats a good jQuery menu?” is a question I hear quite frequently on blogs and forums. As jQuery is such a simple language to learn, most people code their own for their own sites. I’ve compiled a list of 3 menu plugins, and and 5 ‘custom’ solutions that people have setup.</span></p>
<p><span style="font-size: 11pt;"><a href="http://p.sohei.org/jquery-plugins/menu/">http://p.sohei.org/jquery-plugins/menu/</a></span><br />
<span>Latest release: Jan 07</span></p>
<p><!--[if gte vml 1]><v:shapetype id="_x0000_t75" coordsize="21600,21600"  o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f"  stroked="f"> <v:stroke joinstyle="miter" /> <v:formulas> <v:f eqn="if lineDrawn pixelLineWidth 0" /> <v:f eqn="sum @0 1 0" /> <v:f eqn="sum 0 0 @1" /> <v:f eqn="prod @2 1 2" /> <v:f eqn="prod @3 21600 pixelWidth" /> <v:f eqn="prod @3 21600 pixelHeight" /> <v:f eqn="sum @0 0 1" /> <v:f eqn="prod @6 1 2" /> <v:f eqn="prod @7 21600 pixelWidth" /> <v:f eqn="sum @8 21600 0" /> <v:f eqn="prod @7 21600 pixelHeight" /> <v:f eqn="sum @10 21600 0" /> </v:formulas> <v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect" /> <o:lock v:ext="edit" aspectratio="t" /> </v:shapetype><v:shape id="_x0000_s1026" type="#_x0000_t75" style='position:absolute;  margin-left:171pt;margin-top:5.1pt;width:255.75pt;height:118.5pt;z-index:251656704'> <v:imagedata src="file:///C:\Users\Raghu\AppData\Local\Temp\msohtmlclip1\01\clip_image001.jpg" mce_src="file:///C:\Users\Raghu\AppData\Local\Temp\msohtmlclip1\01\clip_image001.jpg"   o:title="p" /> <w:wrap type="square" /> </v:shape><![endif]--><!--[if !vml]--><a href="http://query7.com/wp-content/uploads/2008/11/psoheiorg.jpg"><img class="size-medium wp-image-226 alignright" title="menu1" src="http://query7.com/wp-content/uploads/2008/11/psoheiorg-300x138.jpg" alt="" width="300" height="138" /></a><!--[endif]--></p>
<p><span>This plugin was constructed to emulate a desk top apps menu. They don’t close until clicked off and are activated by clicking them (rather than hovering). It requires the jQuery dimensions plugin to perform ‘smart calculations’.</span></p>
<p><span>Example Usage: <a href="http://p.sohei.org/stuff/jquery/menu/demo/demo.html">http://p.sohei.org/stuff/jquery/menu/demo/demo.html</a></span><br />
<span>Download: <strong><a href="http://p.sohei.org/jquery-plugins/menu/">http://p.sohei.org/jquery-plugins/menu/</a></strong></span></p>
<p><span style="font-size: 11pt;"><a href="http://jdsharp.us/jQuery/plugins/jdMenu/">http://jdsharp.us/jQuery/plugins/jdMenu/</a></span><br />
<span>Latest release: April 08</span></p>
<p><!--[if gte vml 1]><v:shape id="_x0000_s1027" type="#_x0000_t75"  style='position:absolute;margin-left:207pt;margin-top:8.95pt;width:3in;  height:64.5pt;z-index:251657728'> <v:imagedata src="file:///C:\Users\Raghu\AppData\Local\Temp\msohtmlclip1\01\clip_image003.jpg" mce_src="file:///C:\Users\Raghu\AppData\Local\Temp\msohtmlclip1\01\clip_image003.jpg"   o:title="jdmenu" /> <w:wrap type="square" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]--></p>
<p><a href="http://query7.com/wp-content/uploads/2008/11/jdmenu.jpg"><img class="size-medium wp-image-227 alignright" title="jdmenu" src="http://query7.com/wp-content/uploads/2008/11/jdmenu-300x89.jpg" alt="" width="300" height="89" /></a><span lang="EN-US">Although the jdMenu plugin is only 3kb itself, it depends on or looks a hell of a lot better with the plugins dimension, positionBy and bgiframe. jdMenu boasts keyboard access and can be easily made into a verticle menu by changing an option.</span><br />
<span>Example Usage &amp; Download: <a href="http://jdsharp.us/jQuery/plugins/jdMenu/">http://jdsharp.us/jQuery/plugins/jdMenu/</a></span><br />
<span style="font-size: 11pt;"><a href="http://users.tpg.com.au/j_birch/plugins/superfish/"></a></span></p>
<p><span style="font-size: 11pt;"><a href="http://users.tpg.com.au/j_birch/plugins/superfish/">http://users.tpg.com.au/j_birch/plugins/superfish/</a></span><br />
<span>Latest release: Sometime in 08</span></p>
<p><!--[if gte vml 1]><v:shape id="_x0000_s1028" type="#_x0000_t75"  style='position:absolute;margin-left:261pt;margin-top:12.8pt;width:168.75pt;  height:135.6pt;z-index:251658752'> <v:imagedata src="file:///C:\Users\Raghu\AppData\Local\Temp\msohtmlclip1\01\clip_image005.jpg" mce_src="file:///C:\Users\Raghu\AppData\Local\Temp\msohtmlclip1\01\clip_image005.jpg"   o:title="superfish" /> <w:wrap type="square" /> </v:shape><![endif]--><!--[if !vml]--><!--[endif]--></p>
<p><a href="http://query7.com/wp-content/uploads/2008/11/superfish.jpg"><img class="size-medium wp-image-228 alignright" title="superfish" src="http://query7.com/wp-content/uploads/2008/11/superfish-300x240.jpg" alt="" width="300" height="240" /></a><span lang="EN-US">Superfish takes a CSS based dropdown then enhances it with jQuery so if the user has Javascript disabled, it degrades perfectly well. Since the menu is mainly CSS based, I’d imagine it’s a fair bit faster than the other options.</span></p>
<p><span>Example Usage: <a href="http://users.tpg.com.au/j_birch/plugins/superfish/#examples">http://users.tpg.com.au/j_birch/plugins/superfish/#examples</a></span><br />
<span>Download: <a href="http://users.tpg.com.au/j_birch/plugins/superfish/#download">http://users.tpg.com.au/j_birch/plugins/superfish/#download</a></span></p>
<p><span>More menus</span></p>
<ul style="type=">
<li><span><a href="http://www.kriesi.at/archives/create-a-multilevel-dropdown-menu-with-css-and-improve-it-via-jquery">http://www.kriesi.at/archives/create-a-multilevel-dropdown-menu-with-css-and-improve-it-via-jquery</a></span></li>
<li><span><a href="http://javascript-array.com/scripts/jquery_simple_drop_down_menu/">http://javascript-array.com/scripts/jquery_simple_drop_down_menu/</a> </span></li>
<li><span><a href="http://designreviver.com/tutorials/jquery-css-example-dropdown-menu/">http://designreviver.com/tutorials/jquery-css-example-dropdown-menu/</a></span></li>
<li><span><a href="http://www.dynamicdrive.com/style/csslibrary/item/jquery_multi_level_css_menu_2/">http://www.dynamicdrive.com/style/csslibrary/item/jquery_multi_level_css_menu_2/</a></span></li>
</ul>
<p style="margin-left: 11pt;"><span>Plugins are useful, but a lot of the time you don’t need their full functionality. If your confident of modifying a few scripts, then taking something like <a href="http://www.kriesi.at/archives/create-a-multilevel-dropdown-menu-with-css-and-improve-it-via-jquery">http://www.kriesi.at/archives/create-a-multilevel-dropdown-menu-with-css-and-improve-it-via-jquery</a> and changing it to meet your needs would be the best way to go. That being said, the plugins have dropshadows and funky multi level code that some of the ‘smaller menus’ do not.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://query7.com/jquery-menu-roundup/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing better jQuery Code</title>
		<link>http://query7.com/writing-better-jquery-code</link>
		<comments>http://query7.com/writing-better-jquery-code#comments</comments>
		<pubDate>Wed, 13 Aug 2008 19:02:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.query7.com/?p=98</guid>
		<description><![CDATA[<p>We all know that jQuery is great, that you can do things in 2-3 lines in jQuery that you can in 20 lines of Javascript, but is your jQuery code starting to get a bit bulky?  Could you do things&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>We all know that jQuery is great, that you can do things in 2-3 lines in jQuery that you can in 20 lines of Javascript, but is your jQuery code starting to get a bit bulky?  Could you do things better?. I&#8217;m going to show you how to reduce a 20-25 line jQuery script into 3 lines by making the script dynamic, and give a few tips on improvement of your code.</p>
<p>What we want: When the user clicks a list item, it will show the corresponding <em>div</em></p>
<pre lang="html">
<ul id="langs">
<li id="php">PHP</li>
<li id="asp">ASP</li>
<li id="ruby">Ruby</li>
<li id="python">Python</li>
<li id="air">AIR</li>
</ul>
<div id="container">
<div id="d_php">http://www.php.net</div>
<div id="d_asp">http://www.asp.net</div>
<div id="d_ruby">http://www.ruby-lang.org</div>
<div id="d_python">http://www.python.org</div>
<div id="d_air">http://www.adobe.com/products/air/</div>
</div>
</pre>
<p>If i were a beginner and i was asked to write the script, i&#8217;d most likely code sections for each <em>id/div</em> such as below.. Once the specified link is clicked it&#8217;ll hide all the <em>div</em>s shown(the other content panels) and then it&#8217;ll fade in the relevant content panel.</p>
<pre lang="javascript">$("ul#langs li#php").click(function(){

	$("div#container div").hide();
	$("div#container div#d_php").fadeIn("slow");

	});

	$("ul#langs li#asp").click(function(){

	$("div#container div").hide();
	$("div#container div#d_asp").fadeIn("slow");

	});</pre>
<p>This is alright.. it does the job but for each id/div you need around 3 lines of code, your also listening for alot of events (all of those clicks) which may use more memory and slow the script down in general.</p>
<p>Instead of listening for unique clicks(php, asp, ruby etc..), why don&#8217;t we just listen for any click (on the list) and after its clicked, find out which item it was by getting the id (via attributes), save it as a variable, and then use that variable in the selector for the <em>div</em>.</p>
<pre lang="javascript">$("ul#langs li").click(function(){

	var elid = $(this).attr('id');
	$("div#container div").hide();

	$("div#container div#d_" + elid + "").fadeIn("slow");

	});</pre>
<p>This code is alot smaller, its scalable and its not going to get any bigger. You can use this method in other applications such as calling for ajax.</p>
<p>Questions/Comments?</p>
<p>**The Next Day**<br />
Thanks for all your thanks/comments/&#8221;gtfo noob why are you programming&#8221;-ings. Matt August, <a href="http://www.staga.net/">Bryan Migliorisi</a> and <a href="http://charlieslatte.blogspot.com/">Karol Kowalski</a> pointed out that you can&#8217;t have more than 1 element with the same <em>id</em>, I completely overlooked this and I&#8217;ve fixed the code up.</p>
]]></content:encoded>
			<wfw:commentRss>http://query7.com/writing-better-jquery-code/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
