<?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>Web Developer Plus &#187; jQuery</title>
	<atom:link href="http://webdeveloperplus.com/category/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://webdeveloperplus.com</link>
	<description>The Ultimate Web Developer&#039;s Resource</description>
	<lastBuildDate>Mon, 09 Nov 2009 08:15:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Quick &amp; Easy Way to Implement Drag n Share With jQuery</title>
		<link>http://webdeveloperplus.com/jquery/quick-easy-way-to-implement-drag-n-share-with-jquery/</link>
		<comments>http://webdeveloperplus.com/jquery/quick-easy-way-to-implement-drag-n-share-with-jquery/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 14:09:13 +0000</pubDate>
		<dc:creator>Satbir</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jquery plugins]]></category>
		<category><![CDATA[user interface]]></category>

		<guid isPermaLink="false">http://webdeveloperplus.com/?p=626</guid>
		<description><![CDATA[You must have seen the drag to share functionality on Mashable that lets visitors share the content on popular social networks intuitively. here is a much elegant solution to achieve the drag n share effect using jQuery with just a line or two of JavaScript code.]]></description>
			<content:encoded><![CDATA[<p><img src="http://webdeveloperplus.com/wp-content/uploads/2009/11/drag-n-share-jquery.jpg" alt="Drag to Share with jQuery" title="Drag to Share with jQuery" width="500" height="278" class="alignnone size-full wp-image-627" /><br />
You must have seen the drag to share functionality on <a href="http://mashable.com" >Mashable</a> that lets visitors share the content on popular social networks intuitively. Just drag one of the images in an article and you&#8217;ll be able to share the article on your favorite social network by dropping the dragged image over its icon. Even, Nettuts has written a nice <a href="http://net.tutsplus.com/tutorials/javascript-ajax/drag-to-share/">tutorial</a> on how to implement this functionality into your website using jQuery. But here is a much elegant solution to achieve the drag n share effect using jQuery with just a line or two of JavaScript code.<br />
<span id="more-626"></span></p>
<h3>Get the prettySociable Plugin</h3>
<p>To implement this functionality, you will need the <a href="http://www.no-margin-for-errors.com/projects/prettySociable/"><strong>prettySociable jQuery plugin</strong></a> written by Stéphane Caron. Download and extract the plugin, it contains everything you need to get up and running with drag n share.</p>
<h3>Include the Required Files</h3>
<p>To add drag n share to a page, add reference to jquery and prettySociable in your page&#8217;s <code>head</code> tag. The plugin folder also includes <em>images and css</em> folders in addition to <em>js</em> folder. You&#8217;ll need them too as <em>css</em> folder contains styles necessary for drag n share elements and <em>images</em> folder contains icons for various social networks.<br />
Here&#8217;s the complete code you need to add into the  <code>head</code> tag.</p>
<pre name="code" class="html" >
&lt;link rel=&quot;stylesheet&quot; href=&quot;css/prettySociable.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; charset=&quot;utf-8&quot; /&gt;
&lt;script src=&quot;js/jquery-1.3.2.min.js&quot; type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;
&lt;!--[if lte IE 6]&gt;&lt;script src=&quot;js/DD_belatedPNG.js&quot; type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;&lt;![endif]--&gt;
&lt;script src=&quot;js/jquery.prettySociable.js&quot; type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;
</pre>
<p>The <em>js</em> folder also includes <em>DD_belatedPNG.js</em> which is used to fix PNG transparency issues in IE6 or older. You need to include that too.</p>
<h3>Define Draggable Links</h3>
<p>Now to add drag n share to your web page, add an anchor tag <code>&lt;a href=&quot;#&quot; &gt;</code> with another attribute <code>rel=&quot;prettySociable&quot;</code>.</p>
<h3>Initialize prettySociable</h3>
<p>After you have added the <strong>rel</strong> attribute, you need to initialize the script. Add this single line of code, just above the <code>&lt;/body&gt;</code></p>
<pre name="code" class="html" >
&lt;script type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;
	// Init prettySociable
	$.prettySociable();
&lt;/script&gt;
</pre>
<p>Check out your page in browser and you should get drag to share functionality working nicely.</p>
<h3>Customizing the Default Settings</h3>
<h4>Customizing the Shared Information</h4>
<p>When you add <strong>rel=&quot;prettySociable&quot;</strong> on an anchor tag with its <strong>href=&quot;#&quot;</strong>, this will share the URL of the current web page and use the title and meta description in <code>head</code> tag to display the tooltip on drag. </p>
<p>But if you need to share a different URL instead of the current web page, specify a URL in the <strong>href</strong> attribute. Also you can customize the tooltip information which is shown on dragging. You can specify custom title and description in the <strong>rel</strong> attribute in this way.<br />
<code>rel=&quot;prettySociable;title:custom title;excerpt:custom excerpt;&quot;</code></p>
<h4>Customizing the Sharing Panel</h4>
<p>By default prettySociable supports eight social networks but you can customize the social networks and their icons to your requirement. For that you&#8217;ll need to pass a settings object to <em>prettySociable</em> function.</p>
<p>Here&#8217;s the complete settings object</p>
<pre name="code" class="js" >
$.prettySociable({
				animationSpeed: 'fast', /* fast/slow/normal */
				opacity: 0.90, /* Value between 0 and 1 */
				share_label: 'Drag to share', /* Text displayed when a user rollover an item */
				share_on_label: 'Share on ', /* Text displayed when a user rollover a website to share */
				hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettySociable */
				hover_padding: 0,
				websites: {
					facebook : {
						'active': true,
						'encode':true, // If sharing is not working, try to turn to false
						'title': 'Facebook',
						'url': 'http://www.facebook.com/share.php?u=',
						'icon':'images/prettySociable/large_icons/facebook.png',
						'sizes':{'width':70,'height':70}
					},
					twitter : {
						'active': true,
						'encode':true, // If sharing is not working, try to turn to false
						'title': 'Twitter',
						'url': 'http://twitter.com/home?status=',
						'icon':'images/prettySociable/large_icons/twitter.png',
						'sizes':{'width':70,'height':70}
					},
					delicious : {
						'active': true,
						'encode':true, // If sharing is not working, try to turn to false
						'title': 'Delicious',
						'url': 'http://del.icio.us/post?url=',
						'icon':'images/prettySociable/large_icons/delicious.png',
						'sizes':{'width':70,'height':70}
					},
					digg : {
						'active': true,
						'encode':true, // If sharing is not working, try to turn to false
						'title': 'Digg',
						'url': 'http://digg.com/submit?phase=2&amp;amp;url=',
						'icon':'images/prettySociable/large_icons/digg.png',
						'sizes':{'width':70,'height':70}
					}
					//add more social networks here
				},
				tooltip: {
						offsetTop:0,
						offsetLeft: 10
					},
				popup: {
					width: 900,
					height: 500
				},
				callback: function(){} /* Called when prettySociable is closed */
			});
</pre>
<p>The settings object is self explaining. You can specify which websites to use and also the icons to use for each website in the websites parameter.</p>
<p>You can enhance this drag n share script even further by using a shortened URL in the anchor tag&#8217;s <strong>href</strong> attribute.</p>
<p><a href="http://demo.webdeveloperplus.com/drag-n-share-jquery/" title="View Demo" ><strong>View Demo</strong></a> or <a href="http://www.no-margin-for-errors.com/projects/prettySociable/" title="Download prettySociable Plugin"><strong>Download prettySociable jQuery plugin</strong></a>.</p>
<p><em>P.S.</em>: To get this script to work correctly in IE, you will need to set <strong>margin and padding values</strong> in the style-sheet for anchor elements which are draggable.</p>


<p>Related posts:<ol><li><a href='http://webdeveloperplus.com/jquery/collpasible-drag-drop-panels/' rel='bookmark' title='Permanent Link: Collapsible Drag &#038; Drop Panels Using jQuery'>Collapsible Drag &#038; Drop Panels Using jQuery</a></li>
<li><a href='http://webdeveloperplus.com/jquery/ajax-multiple-file-upload-form-using-jquery/' rel='bookmark' title='Permanent Link: AJAX Multiple File Upload Form Using jQuery'>AJAX Multiple File Upload Form Using jQuery</a></li>
<li><a href='http://webdeveloperplus.com/jquery/saving-state-for-collapsible-drag-drop-panels/' rel='bookmark' title='Permanent Link: Saving State For Collapsible Drag Drop Panels'>Saving State For Collapsible Drag Drop Panels</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://webdeveloperplus.com/jquery/quick-easy-way-to-implement-drag-n-share-with-jquery/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>15 Ways to Improve CSS Techniques Using jQuery</title>
		<link>http://webdeveloperplus.com/css/15-ways-to-improve-css-techniques-using-jquery/</link>
		<comments>http://webdeveloperplus.com/css/15-ways-to-improve-css-techniques-using-jquery/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 01:36:37 +0000</pubDate>
		<dc:creator>Satbir</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Popular]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[jquery plugins]]></category>
		<category><![CDATA[user interface]]></category>

		<guid isPermaLink="false">http://webdeveloperplus.com/?p=516</guid>
		<description><![CDATA[CSS is great and when it is combined with powerful JavaScript frameworks like jQuery, you can enhance the user experience by providing more intuitive and responsive web interface. Here are 15 ways you can use jQuery to improve CSS techniques.]]></description>
			<content:encoded><![CDATA[<p>CSS is great and when it is combined with powerful JavaScript frameworks like jQuery, you can achieve some really amazing things. Combining these two together will let you enhance the user experience by providing more intuitive and responsive web interface. Here are 15 ways you can use jQuery to improve CSS techniques.</p>
<h4>1. Custom Styled Radio Buttons and Checkboxes</h4>
<p>It is always hard and next to impossible to customize style of radio buttons and checkboxes. But using jQuery we can easily customize the radio buttons and check boxes to make them more user friendly. Here are two different ways to stylize them:</p>
<p><a href="http://www.filamentgroup.com/examples/customInput/" ><strong>Custom Designed Checkbox and Radio Buttons</strong></a><br />
<img src="http://webdeveloperplus.com/wp-content/uploads/2009/10/custom-checkboxes.png" alt="Custom Styled Checkboxes and radio buttons" title="Custom Styled Checkboxes and radio buttons" width="500" height="142" class="alignnone size-full wp-image-520" /><br />
<span id="more-516"></span><br />
<a href="http://www.protofunc.com/scripts/jquery/checkbox-radiobutton/" ><strong>Radio Button and Checkbox replacement.</strong></a><br />
<img src="http://webdeveloperplus.com/wp-content/uploads/2009/10/custom-checkboxes-2.png" alt="radiobutton and check box replacement with jquery" title="radiobutton and check box replacement with jquery" width="500" height="161" class="alignnone size-full wp-image-521" /></p>
<h4>2. Setting Equal Heights with jQuery</h4>
<p><img src="http://webdeveloperplus.com/wp-content/uploads/2009/10/equal-height-jquery.png" alt="equal height columns using jquery" title="equal height columns using jquery" width="475" height="240" class="alignnone size-full wp-image-524" /><br />
Creating the visual effect of equal-height columns or content boxes has been a challenge ever since we abandoned table-based layouts. Here&#8217;s the jQuery way to set equal height of multiple elements using the <a href="http://www.filamentgroup.com/lab/setting_equal_heights_with_jquery/">equalHeights plugin</a>. With this plugin, you can make equal height columns with just a single line of code.</p>
<pre name="code" class="js" >
$(&quot;someselector&quot;).equalHeights();
</pre>
<h4>3. Styling Select Elements </h4>
<p><code>&lt;select&gt;</code> is another HTML element that is not easy to customize using CSS, but with jQuery at our disposal, we can certainly make them look cool and usable. </p>
<p><a href="http://www.filamentgroup.com/lab/jquery_ui_selectmenu_an_aria_accessible_plugin_for_styling_a_html_select/" ><strong>jQuery UI Selectmenu</strong></a><br />
This is a plugin for jQuery UI that lets you customize select elements easily.<br />
<img src="http://webdeveloperplus.com/wp-content/uploads/2009/10/selectmenu-jquery-ui.png" alt="jquery ui selectmenu plugin" title="jquery ui selectmenu plugin" width="500" height="160" class="alignnone size-full wp-image-526" /></p>
<p><a href="http://marghoobsuleman.com/mywork/jcomponents/image-dropdown/jquery-image-dropdown-2.1/index.html" ><strong>jQuery image dropdown</strong></a><br />
<img src="http://webdeveloperplus.com/wp-content/uploads/2009/10/image-dropdown.png" alt="jQuery image dropdown" title="jQuery image dropdown" width="500" height="186" class="alignnone size-full wp-image-525" /></p>
<h4>4. Current Field Highlighting in Forms</h4>
<p><img src="http://webdeveloperplus.com/wp-content/uploads/2009/10/current-field-highlight.png" alt="highlight current field in a form" title="highlight current field in a form" width="500" height="107" class="alignnone size-full wp-image-519" /><br />
It is always good to provide a visual feedback to users when they perform any action while using a web form. Highlighting the field in which user is currently typing is one of the usability features you should add to web forms. Though, this can be achieved using the <code>:focus</code> pseudo selector in CSS. But this technique of <a href="http://css-tricks.com/improved-current-field-highlighting-in-forms/" >highlighting the label along with the selected input field</a> from CSS Tricks provides good user experience.</p>
<h4>5. Fix IE Overflow problem</h4>
<p>Internet Explorer has this rather strange problem, when <code>overflow</code> is set to auto or scroll, the scrollbar shows up inside the width of element. This is fine when you have multiple lines of text within that element, but if you just have a single line of text, then scrollbar would cover that and it won&#8217;t be visible. This <a href="http://remysharp.com/2008/01/21/fixing-ie-overflow-problem/">jQuery technique</a> from Remy Sharp will fix that IE bug.</p>
<h4>6. Block Hover Effect</h4>
<p><img src="http://webdeveloperplus.com/wp-content/uploads/2009/10/jquery-biggerlink.png" alt="jquery biggerlink" title="jquery biggerlink" width="500" height="160" class="alignnone size-full wp-image-527" /><br />
Creating block hover effect with CSS using <code>display:block</code> is possible but when you have some other content inside a box alongside the link, then it is not possible to create a semantically correct block hover effect using CSS. Here&#8217;s a nice jQuery plugin &#8211; <a href="http://www.ollicle.com/eg/jquery/biggerlink/" ><strong>Bigger Link</strong></a> to achieve that.</p>
<h4>7. Rounded Corners</h4>
<p><img src="http://webdeveloperplus.com/wp-content/uploads/2009/10/jquery-curvy-corners.png" alt="jQuery Curvy Corners" title="jQuery Curvy Corners" width="500" height="160" class="alignnone size-full wp-image-530" /><br />
CSS Rounded corners are now supported by most browsers like Firefox, Safari but some browsers like IE do not support them. For those unsupported browsers, you can use <a href="http://blue-anvil.com/jquerycurvycorners/test.html" ><strong>jQuery Curvy Corners</strong></a>.</p>
<h4>8. Attractive Menus with jQuery</h4>
<p>Creating a CSS based navigational menu that displays hover state separately is not difficult, but with a little amount of jQuery you can achieve some really nice effects. Check out these two example menus that use jQuery to produce a very subtle hover effect.<br />
<a href="http://www.queness.com/post/411/create-an-attractive-jquery-menu-with-fadein-and-fadeout-effect" ><strong>Create an Attractive jQuery Menu with Fade In and Fade Out Effect</strong></a><br />
<img src="http://webdeveloperplus.com/wp-content/uploads/2009/10/jquery-attractive-menu.png" alt="Attractive menu with jQuery" title="Attractive menu with jQuery" width="500" height="89" class="alignnone size-full wp-image-532" /><br />
<a href="http://www.shopdev.co.uk/blog/animated-menus-using-jquery/" ><strong>Animated Menu Using jQuery</strong></a><br />
<img src="http://webdeveloperplus.com/wp-content/uploads/2009/10/jquery-animated-menu.png" alt="Animated menu with jQuery" title="Animated menu with jQuery" width="500" height="100" class="alignnone size-full wp-image-531" /></p>
<h4>9. Creating a Floating HTML Menu Using jQuery and CSS</h4>
<p><img src="http://webdeveloperplus.com/wp-content/uploads/2009/10/live-floating-menu.png" alt="Live Floating Menu" title="Live Floating Menu" width="500" height="190" class="alignnone size-full wp-image-535" /><br />
You can fix the position of an element using the <code>position:fixed</code> property but that won&#8217;t provide as rich user experience as <a href="http://net.tutsplus.com/html-css-techniques/creating-a-floating-html-menu-using-jquery-and-css/">Live floating menu using jQuery</a>. It creates a floating menu on the page and as you scroll down, menu also follows your mouse  scroll.</p>
<h4>10. Splitting Content over multiple columns</h4>
<p><img src="http://webdeveloperplus.com/wp-content/uploads/2009/10/columnizer-jquery-plugin.png" alt="Split content into multiple columns" title="Split content into multiple columns" width="500" height="250" class="alignnone size-full wp-image-536" /><br />
Ever thought of splitting text of a page into multiple columns just like newspaper. With CSS, this will take a lot of effort but this <a href="http://welcome.totheinter.net/columnizer-jquery-plugin/"><strong>Columnizer jQuery plugin</strong></a> will do all the effort for you to split content into multiple columns with a single line of code.</p>
<h4>11. Semantic Blockquotes with jQuery</h4>
<p><img src="http://webdeveloperplus.com/wp-content/uploads/2009/10/blockquotes.jpg" alt="Semantic Blockquoteswith jQuery" title="Semantic Blockquoteswith jQuery" width="500" height="141" class="alignnone size-full wp-image-537" /><br />
If you use blockquotes in your design to highlight important points of an article, then you also duplicate the content within blockquotes as it is also there in the article. Here&#8217;s a <a href="http://www.thewebsqueeze.com/web-design-tutorials/semantic-blockquotes-with-jquery.html">nice jquery way</a> to do this leaving the duplication of content to jQuery by specifying which content to show as blockquote.</p>
<h4>12. Text Shadows</h4>
<p><img src="http://webdeveloperplus.com/wp-content/uploads/2009/10/text-shadow-ie.png" alt="Text Shadow in IE" title="Text Shadow in IE" width="500" height="170" class="alignnone size-full wp-image-538" /><br />
CSS3 includes a nice property of text-shadow that allows you to set a text-shadow generate nice text-effects without using any images. But IE does not support this feature till date. <a href="http://kilianvalkhof.com/2008/javascript/text-shadow-in-ie-with-jquery/" ><strong>Text-shadow in IE</strong></a> adds this support to Internet Explorer using jQuery.</p>
<h4>13. Border Image</h4>
<p><img src="http://webdeveloperplus.com/wp-content/uploads/2009/10/border-image.png" alt="CSS3 border-image" title="CSS3 border-image" width="465" height="177" class="alignnone size-full wp-image-539" /><br />
CSS3 lets you use images as border backgrounds in addition to just colors. But since it is not supported my many browsers, you&#8217;ll need jQuery to come to rescue. <a href="http://www.lrbabe.com/sdoms/borderImage/index.html"><strong>jQuery.borderimage</strong></a> provides cross-browser support for <code>border-image</code> property.</p>
<h4>14. Opacity</h4>
<p>Opacity is one such CSS property which is supported by most browsers including IE but each has a different way to implement it, though CSS3 standard defines a property <code>opacity</code> to be used for setting opacity of elements, but you end up writing many lines of CSS code just to make opacity cross-browser compatible. jQuery can make this easier too.</p>
<pre name="code" class="js" >
$(&quot;someselectoe&quot;).css(&quot;opacity&quot;, 0.5);
</pre>
<h4>15. Super CSS Selector Support with jQuery</h4>
<p>CSS 2.1 supports various types of selectors including <code>:focus, :first-child, nth-child</code> but not all browsers(IE!) support these selectors. but with <a href=" http://skulljackpot.com/2009/04/19/super-css-selector-support-with-jquery/"><strong>Super CSS Selector</strong></a>, you can be sure to have support for those selectors even in IE.</p>


<p>Related posts:<ol><li><a href='http://webdeveloperplus.com/css/21-amazing-css-techniques-you-should-know/' rel='bookmark' title='Permanent Link: 21 Amazing CSS Techniques You Should Know'>21 Amazing CSS Techniques You Should Know</a></li>
<li><a href='http://webdeveloperplus.com/css/text-shadow-property-in-css3/' rel='bookmark' title='Permanent Link: Text Shadow Property in CSS3'>Text Shadow Property in CSS3</a></li>
<li><a href='http://webdeveloperplus.com/css/25-incredibly-useful-css-tricks-you-should-know/' rel='bookmark' title='Permanent Link: 25 Incredibly Useful CSS Tricks You Should Know'>25 Incredibly Useful CSS Tricks You Should Know</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://webdeveloperplus.com/css/15-ways-to-improve-css-techniques-using-jquery/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>AJAX User Poll Using jQuery and PHP</title>
		<link>http://webdeveloperplus.com/php/ajax-user-poll-using-jquery-and-php/</link>
		<comments>http://webdeveloperplus.com/php/ajax-user-poll-using-jquery-and-php/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 07:49:54 +0000</pubDate>
		<dc:creator>Satbir</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[user poll]]></category>

		<guid isPermaLink="false">http://webdeveloperplus.com/?p=494</guid>
		<description><![CDATA[Today, we&#8217;ll be creating a nice user poll script using jQuery and PHP utilizing AJAX and animation effects of jQuery to spice up the user interface and provide a rich user experience. Let&#8217;s get started. Set up the database For storing poll questions, options and votes, we&#8217;ll be using a MySQL database. Here is the [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://webdeveloperplus.com/wp-content/uploads/2009/10/ajax-poll-jquery.png" alt="AJAX User Poll Using jQuery, PHP" title="AJAX User Poll Using jQuery, PHP" width="599" height="376" class="alignnone size-full wp-image-495" /><br />
Today, we&#8217;ll be creating a nice user poll script using jQuery and PHP utilizing  AJAX and animation effects of jQuery to spice up the user interface and provide a rich user experience. Let&#8217;s get started.</p>
<h3>Set up the database</h3>
<p>For storing poll questions, options and votes, we&#8217;ll be using a MySQL database. Here is the database structure required.<span id="more-494"></span><br />
<img src="http://webdeveloperplus.com/wp-content/uploads/2009/10/ajax-poll-database-structure.jpg" alt="Database Structure" title="Database Structure" width="460" height="192" class="alignnone size-full wp-image-496" /><br />
There are three tables:</p>
<ul>
<li><strong>questions</strong> table stores the poll questions.</li>
<li><strong>options</strong> table stores the options of a particular question.</li>
<li><strong>votes</strong> table stores information about each vote cast by the user.</li>
</ul>
<p>The required SQL code with sample data is provided in source code(below).</p>
<h3>The PHP Code</h3>
<h4>Displaying the poll form</h4>
<p>We&#8217;ll display the most recent poll question from the database and allow the user to vote for it. Here&#8217;s the required PHP code to generate poll form for latest poll question.</p>
<pre name="code" class="php" >
$conn=mysql_connect('localhost', 'root', 'password') or die(&quot;Can't connect to mysql host&quot;);
mysql_select_db(&quot;polls&quot;);
$query=mysql_query(&quot;SELECT id, ques FROM questions ORDER BY id DESC LIMIT 1&quot;);
while($row=mysql_fetch_assoc($query)){
	//display question
	echo &quot;&lt;p class=\&quot;pollques\&quot; &gt;&quot;.$row[&quot;ques&quot;].&quot;&lt;/p&gt;&quot;;
	$poll_id=$row[&quot;id&quot;];
}
//display options with radio buttons
$query=mysql_query(&quot;SELECT id, value FROM options WHERE ques_id=$poll_id&quot;);
if(mysql_num_rows($query)){
		echo '&lt;div id=&quot;formcontainer&quot; &gt;&lt;form method=&quot;post&quot; id=&quot;pollform&quot; action=&quot;'.$_SERVER['PHP_SELF'].'&quot; &gt;';
		echo '&lt;input type=&quot;hidden&quot; name=&quot;pollid&quot; value=&quot;'.$poll_id.'&quot; /&gt;';
		while($row=mysql_fetch_assoc($query)){
			echo '&lt;p&gt;&lt;input type=&quot;radio&quot; name=&quot;poll&quot; value=&quot;'.$row['id'].'&quot; id=&quot;option-'.$row['id'].'&quot; /&gt;
			&lt;label for=&quot;option-'.$row['id'].'&quot; &gt;'.$row['value'].'&lt;/label&gt;&lt;/p&gt;';
		}
		echo '&lt;p&gt;&lt;input type=&quot;submit&quot;  value=&quot;Submit&quot; /&gt;&lt;/p&gt;&lt;/form&gt;';
}
</pre>
<h4>Processing the Submitted Vote</h4>
<p>When user selects an answer and submits the form, we add the information to the <em>votes</em> table about the option selected and also set a cookie in user&#8217;s browser to identify that he has voted for the poll. </p>
<pre name="code" class="php" >
$query=mysql_query(&quot;SELECT * FROM options WHERE id='&quot;.intval($_POST[&quot;poll&quot;]).&quot;'&quot;);
if(mysql_num_rows($query)){
	$query=&quot;INSERT INTO votes(option_id, voted_on, ip) VALUES('&quot;.$_POST[&quot;poll&quot;].&quot;', '&quot;.date('Y-m-d H:i:s').&quot;', '&quot;.$_SERVER['REMOTE_ADDR'].&quot;')&quot;;
	if(mysql_query($query))
	{
		//Vote added to database
		setcookie(&quot;voted&quot;.$_POST['pollid'], 'yes', time()+86400*300);
	}
	else
		echo &quot;There was some error processing the query: &quot;.mysql_error();
}
</pre>
<p>In this case we first check to see if the answer to poll question has been provided and whether the user hasnot already voted(<em>code omitted for simplicity</em>) the selected option is there in database or not. Also here we are using <code>intval()</code> function to make sure only integer value for selected option passes through. After checking the information, the user vote is added to the <em>votes</em> table.</p>
<h4>Displaying the Results</h4>
<p>Once the user has voted, it&#8217;s time to display the results to him. We&#8217;ll be using the easy way out to display the result using CSS. Here&#8217;s the code for that.</p>
<pre name="code" class="php" >
$query=mysql_query(&quot;SELECT COUNT(*) as totalvotes FROM votes WHERE option_id IN(SELECT id FROM options WHERE ques_id='$poll_id')&quot;);
while($row=mysql_fetch_assoc($query))
	$total=$row['totalvotes'];
$query=mysql_query(&quot;SELECT options.id, options.value, COUNT(*) as votes FROM votes, options WHERE votes.option_id=options.id AND votes.option_id IN(SELECT id FROM options WHERE ques_id='$poll_id') GROUP BY votes.option_id&quot;);
while($row=mysql_fetch_assoc($query)){
	$percent=round(($row['votes']*100)/$total);
	echo '&lt;div class=&quot;option&quot; &gt;&lt;p&gt;'.$row['value'].' (&lt;em&gt;'.$percent.'%, '.$row['votes'].' votes&lt;/em&gt;)&lt;/p&gt;';
	echo '&lt;div class=&quot;bar ';
	if($_POST['poll']==$row['id']) echo ' yourvote';
	echo '&quot; style=&quot;width: '.$percent.'%; &quot; &gt;&lt;/div&gt;&lt;/div&gt;';
}
echo '&lt;p&gt;Total Votes: '.$total.'&lt;/p&gt;';
</pre>
<p>To display the results from the information we have in <strong>votes</strong> table, we will use a <strong>GROUP BY</strong> query to find out votes per option and then set the width of display bar based on percentage of votes each option received.</p>
<p>All the PHP code is in <strong>poll.php</strong> file.</p>
<h3>HTML Structure</h3>
<p>HTML structure is quite simple as jQuery will do the heavy lifting. We only need to define a container that will hold the poll form or display the results.</p>
<pre name="code" class="html" >
&lt;div id=&quot;container&quot; &gt;
	&lt;h1&gt;User Poll&lt;/h1&gt;
	&lt;div id=&quot;pollcontainer&quot; &gt;
	&lt;/div&gt;
	&lt;p id=&quot;loader&quot; &gt;Loading...&lt;/p&gt;
&lt;/div&gt;
</pre>
<h3>The JavaScript Code</h3>
<h4>Loading the Poll Form</h4>
<p>On page load, we will load and display the poll form to user and if user has already voted, then results will be displayed.</p>
<pre name="code" class="js">
var loader=$('#loader');
	var pollcontainer=$('#pollcontainer');
	loader.fadeIn();
	//Load the poll form
	$.get('poll.php', '', function(data, status){
		pollcontainer.html(data);
		animateResults(pollcontainer);
		pollcontainer.find('#viewresult').click(function(){
			//if user wants to see result
			loader.fadeIn();
			$.get('poll.php', 'result=1', function(data,status){
				pollcontainer.fadeOut(1000, function(){
					$(this).html(data);
					animateResults(this);
				});
				loader.fadeOut();
			});
			//prevent default behavior
			return false;
		})
</pre>
<h4>Processing User Vote</h4>
<p>To process the user vote, we first check to see if user has selected one of the options and then post the form data to <strong>poll.php</strong> and then display the results to the user in a nice animated way using the function <code>animateResults</code>. </p>
<pre name="code" class="js" >
('#pollform').submit(function(){
			var selected_val=$(this).find('input[name=poll]:checked').val();
			if(selected_val!=''){
				//post data only if a value is selected
				loader.fadeIn();
				$.post('poll.php', $(this).serialize(), function(data, status){
					$('#formcontainer').fadeOut(100, function(){
						$(this).html(data);
						animateResults(this);
						loader.fadeOut();
					});
				});
			}
			//prevent form default behavior
			return false;
		});
</pre>
<p>Download the complete source code and try it out for yourself.</p>
<div class="demo" ><a href="http://demo.webdeveloperplus.com/source-code/ajax-poll.zip" >Download</a></div>
<p><strong>Remember to set up database and tables using <em>polls.sql</em> file provided in source code and update database information in the <em>poll.php</em> file</strong> before trying out.</p>
<p><strong>Note:</strong> In this tutorial, i have only covered the user interface part of the user poll script. You&#8217;ll have to code the user interface for creating new polls or manually have to add questions and options in the tables. The sample database file provided with the source code contains a sample poll question along with some sample data.</p>


<p>Related posts:<ol><li><a href='http://webdeveloperplus.com/jquery/ajax-multiple-file-upload-form-using-jquery/' rel='bookmark' title='Permanent Link: AJAX Multiple File Upload Form Using jQuery'>AJAX Multiple File Upload Form Using jQuery</a></li>
<li><a href='http://webdeveloperplus.com/php/25-new-useful-php-techniques-tutorials/' rel='bookmark' title='Permanent Link: 25 New &#038; Useful PHP Techniques &#038; Tutorials'>25 New &#038; Useful PHP Techniques &#038; Tutorials</a></li>
<li><a href='http://webdeveloperplus.com/php/integrate-customized-recaptcha-in-your-php-application/' rel='bookmark' title='Permanent Link: Integrate Customized reCaptcha in your PHP Application'>Integrate Customized reCaptcha in your PHP Application</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://webdeveloperplus.com/php/ajax-user-poll-using-jquery-and-php/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Saving State For Collapsible Drag Drop Panels</title>
		<link>http://webdeveloperplus.com/jquery/saving-state-for-collapsible-drag-drop-panels/</link>
		<comments>http://webdeveloperplus.com/jquery/saving-state-for-collapsible-drag-drop-panels/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 07:11:36 +0000</pubDate>
		<dc:creator>Satbir</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[drag drop panels]]></category>
		<category><![CDATA[jquery ui]]></category>
		<category><![CDATA[JSON]]></category>

		<guid isPermaLink="false">http://webdeveloperplus.com/?p=417</guid>
		<description><![CDATA[I earlier posted about Collapsible Drag and Drop Panels using jQuery where many of you asked about how to save the state of panels and retrieve them when user loads the page again. Here&#8217;s the complete solution to that problem using MySQL database to store the state of panels. Also, there were some browser dependent [...]]]></description>
			<content:encoded><![CDATA[<p><img class="largepostimage" title="Collapsible Drag Drop Panels" src="http://webdeveloperplus.com/wp-content/uploads/2009/08/drag-drop-collapsible-panels.png" alt="Collapsible Drag Drop Panels" width="600" height="306" /></p>
<p>I earlier posted about <a title="Collapsible Drag n Drop Panels" href="http://webdeveloperplus.com/jquery/collpasible-drag-drop-panels/">Collapsible Drag and Drop Panels using jQuery</a> where many of you asked about how to save the state of panels and retrieve them when user loads the page again. Here&#8217;s the complete solution to that problem using MySQL database to store the state of panels. Also, there were some browser dependent problems which i have tried to remove, let me know if you still encounter any problem implementing.</p>
<p><span id="more-417"></span></p>
<p>You can <a title="Download Source Code" href="http://demo.webdeveloperplus.com/source-code/drag-drop-panels-v2.0.zip">download the source code</a> and try it for yourself.</p>
<h3>Creating the Database</h3>
<p>The database table <em>widgets</em> consists of 5 columns:<br />
<img alt="" src="http://static.webdeveloperplus.com/uploads/2009/09/drag-drop-panels-table.png" title="Table Structure Drag Drop Panels" class="largepostimage" width="594" height="152" /></p>
<ul>
<li><em>id</em> stores the id of panel.</li>
<li><em>column_id</em> is the column number to which panel belongs.</li>
<li><em>sort_no</em> is the order of panel within column.</li>
<li><em>collapsed</em> stores information about whether the panel is collapsed or not.</li>
<li><em>title</em> is the title of the widget.</li>
</ul>
<p>You can of course add more columns to this database but first four are  critical to working of the script. You can add more columns like RSS feed URL that you want to display in that panel or its content etc. To keep things simple and easy to understand, i have skipped that.<br />
Here&#8217;s the SQL code:</p>
<pre name="code" class="sql" >
CREATE TABLE IF NOT EXISTS `widgets` (
  `id` int(11) NOT NULL auto_increment,
  `column_id` int(11) NOT NULL,
  `sort_no` int(11) NOT NULL,
  `collapsed` tinyint(4) NOT NULL,
  `title` varchar(100) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ;

--
-- Dumping data for table `widgets`
--

INSERT INTO `widgets` (`id`, `column_id`, `sort_no`, `collapsed`, `title`) VALUES
(1, 2, 0, 1, 'Widget 1'),
(2, 1, 0, 0, 'Widget 2'),
(3, 2, 1, 0, 'Widget 3'),
(4, 2, 2, 0, 'Widget 4'),
(5, 1, 1, 1, 'Widget 5');
</pre>
<p>As you can see, I have also added some default data to widgets table, but if you are using this in production environment, you will have to create an interface for adding new panels which will add new rows to <em>widgets</em> table.</p>
<h3>Displaying Panels Using Database</h3>
<p>Since I added some default data to widgets table, here&#8217;s how to display the widgets keeping their saved state intact.</p>
<p><strong>Remember to update the Database configuration detail in <em>config.php</em> file.</strong><br />
This code is within <em>index.php</em> file.</p>
<pre name="code" class="php" >
&lt;div id=&quot;console&quot; &gt;&lt;/div&gt;

		&lt;?php
		$dummy=&quot;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vestibulum velit ultricies orci pharetra elementum. In massa mauris, varius sed tempus a, iaculis sed erat. Ut sollicitudin tellus mollis arcu laoreet semper. Suspendisse ut felis odio. Aliquam auctor, tortor sit amet suscipit elementum, nunc ante dictum lectus, ac accumsan justo nunc sed velit. Sed sollicitudin varius tortor vitae varius..&quot;;

		include('./config.php');

			$columns=mysql_query('SELECT DISTINCT column_id FROM widgets ORDER BY column_id');
			while($column=mysql_fetch_array($columns))
			{
				echo '&lt;div class=&quot;column&quot; id=&quot;column'.$column['column_id'].'&quot; &gt;';
				$items=mysql_query(&quot;SELECT * FROM widgets WHERE column_id='&quot;.$column['column_id'].&quot;' ORDER BY sort_no&quot;);
				while($widget=mysql_fetch_array($items))
				{
					echo '
					&lt;div class=&quot;dragbox&quot; id=&quot;item'.$widget['id'].'&quot;&gt;
						&lt;h2&gt;'.$widget['title'].'&lt;/h2&gt;
							&lt;div class=&quot;dragbox-content&quot; ';
					if($widget['collapsed']==1)
						echo 'style=&quot;display:none;&quot; ';
					echo '&gt;
								'.substr($dummy, 0, rand(120, strlen($dummy))).'
							&lt;/div&gt;
					&lt;/div&gt;';
				}
				echo '&lt;/div&gt;';
			}
		?&gt;
</pre>
<p><strong>Explanation</strong> First of all, fetch the unique <em>column_id</em>&#8216;s from widgets table and then for each column, their panels in the sort order and then display them.<br />
I&#8217;m using a variable <code>$dummy</code> to produce dummy content for widgets. </p>
<h3>The JavaScript Code</h3>
<p>In earlier article, i wrote about a variable <em>sortorder</em> that was used to pass information to server side script for processing. But it only stored information about order of panels and their column but not the state of each panel i.e. whether panel is collapsed or not was not passed to server side script.</p>
<p>So, I worked out the JavaScript code so that it saves all the information about state of each panel that is its column, its order in the column and its collapse state.<br />
For that I have used an array of JavaScript objects with each object storing information about each panel.</p>
<p>And to pass the array of objects, I used <a href="http://code.google.com/p/jquery-json/" target="_blank" title="jQuery JSON plugin">jQuery JSON plugin</a>(mere 2KB) that will make it easy to pass data to server side script in JSON format.</p>
<p>Moreover, since state needs to be saved not only when panels are changed by dragging but also when a panel is collapsed or opened. That is why I created a function <code>updateWidgetData()</code> that will be called whenever the state needs to be saved.</p>
<p>Here&#8217;s the JavaScript code, it resides within <code>&lt;head&gt;</code> tag inside <em>index.php</em> file.</p>
<pre name="code" class="js" >
$(function(){
	$('.dragbox')
	.each(function(){
		$(this).hover(function(){
			$(this).find('h2').addClass('collapse');
		}, function(){
		$(this).find('h2').removeClass('collapse');
		})
		.find('h2').hover(function(){
			$(this).find('.configure').css('visibility', 'visible');
		}, function(){
			$(this).find('.configure').css('visibility', 'hidden');
		})
		.click(function(){
			$(this).siblings('.dragbox-content').toggle();
			//Save state on change of collapse state of panel
			updateWidgetData();
		})
		.end()
		.find('.configure').css('visibility', 'hidden');
	});

	$('.column').sortable({
		connectWith: '.column',
		handle: 'h2',
		cursor: 'move',
		placeholder: 'placeholder',
		forcePlaceholderSize: true,
		opacity: 0.4,
		start: function(event, ui){
			//Firefox, Safari/Chrome fire click event after drag is complete, fix for that
			if($.browser.mozilla || $.browser.safari)
				$(ui.item).find('.dragbox-content').toggle();
		},
		stop: function(event, ui){
			ui.item.css({'top':'0','left':'0'}); //Opera fix
			if(!$.browser.mozilla &amp;&amp; !$.browser.safari)
				updateWidgetData();
		}
	})
	.disableSelection();
});

function updateWidgetData(){
	var items=[];
	$('.column').each(function(){
		var columnId=$(this).attr('id');
		$('.dragbox', this).each(function(i){
			var collapsed=0;
			if($(this).find('.dragbox-content').css('display')==&quot;none&quot;)
				collapsed=1;
			//Create Item object for current panel
			var item={
				id: $(this).attr('id'),
				collapsed: collapsed,
				order : i,
				column: columnId
			};
			//Push item object into items array
			items.push(item);
		});
	});
	//Assign items array to sortorder JSON variable
	var sortorder={ items: items };

	//Pass sortorder variable to server using ajax to save state
	$.post('updatePanels.php', 'data='+$.toJSON(sortorder), function(response){
		if(response==&quot;success&quot;)
			$(&quot;#console&quot;).html('&lt;div class=&quot;success&quot;&gt;Saved&lt;/div&gt;').hide().fadeIn(1000);
		setTimeout(function(){
			$('#console').fadeOut(1000);
		}, 2000);
	});
}
</pre>
<p>There were some browser inconsistencies like Firefox/Safari/Chrome fire click event on drag completion while IE/Opera do not fire which leads to inconsistent state which i have fixed as mentioned within the code.</p>
<h3>PHP Code To Save State</h3>
<p>In the above JavaScript code, I used <em>updatePanels.php</em> in the AJAX call to save state.<br />
Here&#8217;s the code for <em>updatePanels.php</em></p>
<pre name="code" class="php" >
&lt;?php
if(!$_POST[&quot;data&quot;]){
	echo &quot;Invalid data&quot;;
	exit;
}
//Include DB config file
include('./config.php');

//decode JSON data received from AJAX POST request
$data=json_decode($_POST[&quot;data&quot;]);

foreach($data-&gt;items as $item)
{
	//Extract column number for panel
	$col_id=preg_replace('/[^\d\s]/', '', $item-&gt;column);
	//Extract id of the panel
	$widget_id=preg_replace('/[^\d\s]/', '', $item-&gt;id);
	$sql=&quot;UPDATE widgets SET column_id='$col_id', sort_no='&quot;.$item-&gt;order.&quot;', collapsed='&quot;.$item-&gt;collapsed.&quot;' WHERE id='&quot;.$widget_id.&quot;'&quot;;
	mysql_query($sql) or die('Error updating widget DB');
}
echo &quot;success&quot;;

?&gt;
</pre>
<p>The code is pretty self explanatory, just decode the JSON string received from AJAX call and loop through items to save their state to database.</p>
<p><a href="http://demo.webdeveloperplus.com/source-code/drag-drop-panels-v2.0.zip">Download the source code</a></p>
<p>Hopefully this will help solve most of the problems many of you were encountering. Special thanks to <a href="http://www.soddengecko.com/" >Mark Mckee</a> for inspiring me to code the full solution.</p>


<p>Related posts:<ol><li><a href='http://webdeveloperplus.com/jquery/collpasible-drag-drop-panels/' rel='bookmark' title='Permanent Link: Collapsible Drag &#038; Drop Panels Using jQuery'>Collapsible Drag &#038; Drop Panels Using jQuery</a></li>
<li><a href='http://webdeveloperplus.com/php/ajax-user-poll-using-jquery-and-php/' rel='bookmark' title='Permanent Link: AJAX User Poll Using jQuery and PHP'>AJAX User Poll Using jQuery and PHP</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://webdeveloperplus.com/jquery/saving-state-for-collapsible-drag-drop-panels/feed/</wfw:commentRss>
		<slash:comments>37</slash:comments>
		</item>
		<item>
		<title>21 Brilliant jQuery Image Gallery/Slideshow Plugins</title>
		<link>http://webdeveloperplus.com/jquery/21-brilliant-jquery-image-galleryslideshow-plugins/</link>
		<comments>http://webdeveloperplus.com/jquery/21-brilliant-jquery-image-galleryslideshow-plugins/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 08:47:33 +0000</pubDate>
		<dc:creator>Satbir</dc:creator>
				<category><![CDATA[Popular]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[image gallery]]></category>
		<category><![CDATA[jquery plugins]]></category>
		<category><![CDATA[user interface]]></category>

		<guid isPermaLink="false">http://webdeveloperplus.com/?p=391</guid>
		<description><![CDATA[Image galleries and slideshows provide a good user experience and make viewing images more pleasant and intuitive on your website. With the advent of powerful JavaScript frameworks like jQuery, Prototype, Mootools etc., the quality of JavaScript based image galleries and slideshows have improved dramatically. As these frameworks are getting popular day by day, more and [...]]]></description>
			<content:encoded><![CDATA[<p>Image galleries and slideshows provide a good user experience and make viewing images more pleasant and intuitive on your website. With the advent of powerful JavaScript frameworks like jQuery, Prototype, Mootools etc., the quality of JavaScript based image galleries and slideshows have improved dramatically.</p>
<p>As these frameworks are getting popular day by day, more and more web developers are coming out with new and creative ideas every day. Here are 21 brilliant jQuery plugins which you can easily use to create an image gallery/slideshow for your website.</p>
<p><span id="more-391"></span></p>
<h4>1. <a title="Spacegallery jQuery Plugin" href="http://eyecon.ro/spacegallery/" target="_blank">Spacegallery</a></h4>
<p>Spacegallery displays your images with a nice 3D effect and it is also pretty easy to use and customize.</p>
<p><img class="largepostimage" title="Spacegallery jQuery Plugin" src="http://static.webdeveloperplus.com/uploads/2009/09/jquery-image-gallery/spacegallery.jpg" alt="" width="377" height="256" /></p>
<h4>2. <a title="prettyPhoto jQuery Plugin" href="http://www.no-margin-for-errors.com/projects/prettyPhoto-jquery-lightbox-clone/">prettyPhoto</a></h4>
<p>prettyPhoto might look like jQuery Lightbox clone but it supports videos, flash, YouTube videos, iFrames besides images. It also comes with useful API and 4 beautiful themes. It is a great plugin to create an image as well as multimedia gallery.</p>
<p><img class="largepostimage" title="prettyPhoto jQuery Plugin" src="http://static.webdeveloperplus.com/uploads/2009/09/jquery-image-gallery/prettyPhoto.jpg" alt="" width="620" height="418" /></p>
<h4>3. <a title="Zoomimage jQuery Image Gallery" href="http://eyecon.ro/zoomimage/">Zoomimage</a></h4>
<p>Stylish way to present your images in a nice popup with a drop shadow and border.</p>
<p><img class="largepostimage" title="Zoomimage jQuery Image Gallery" src="http://static.webdeveloperplus.com/uploads/2009/09/jquery-image-gallery/zoomimage-gallery-jquery.jpg" alt="" width="565" height="376" /></p>
<h4>4. <a title="Pirobox" href="http://designshack.co.uk/news/pirobox-jquery-lightbox">Pirobox</a></h4>
<p>Another lightbox based image gallery plugin that resizes images based on browser size and next/prev links can be placed inside or outside of the image.</p>
<p><img class="largepostimage" title="Pirobox" src="http://static.webdeveloperplus.com/uploads/2009/09/jquery-image-gallery/Pirobox.jpg" alt="" width="620" height="294" /></p>
<h4>5. <a title="slideViewerPro jQuery Plugin" href="http://www.gcmingati.net/wordpress/wp-content/lab/jquery/svwt/index.html">slideViewerPro</a></h4>
<p>slideViewerPro is a fully customizable jQuery image gallery engine that lets you create outstanding sliding image galleries for your projects or interactive galleries within blog posts.</p>
<p><img class="largepostimage" title="slideViewer Pro Gallery " src="http://static.webdeveloperplus.com/uploads/2009/09/jquery-image-gallery/slideViewerPro.jpg" alt="" width="614" height="347" /></p>
<h4>6. <a title="Galleria jQuery Plugin" href="http://devkick.com/lab/galleria/">Galleria</a></h4>
<p>Galleria generates an image gallery from an unordered list and once the images are loaded, thumbnail navigation is generated. It is easy to customize using just CSS and degrades gracefully if JavaScript is disabled.</p>
<p><img class="largepostimage" title="Galleria Image gallery" src="http://static.webdeveloperplus.com/uploads/2009/09/jquery-image-gallery/galleria.jpg" alt="" width="620" height="378" /></p>
<h4>7. <a title="jQuery PanelGallery 1.1" href="http://www.catchmyfame.com/2009/08/13/jquery-panel-gallery-1-1-plugin-released/">jQuery PanelGallery</a></h4>
<p>jQuery PanelGallery generates a slideshow of images with a unique transition. Image transition occurs in a sequential manner displaying the new image panel by panel, thus the name PanelGallery. It is lightweight and allows you to change the direction of panel transition.</p>
<p><img class="largepostimage" title="Panel Gallery" src="http://static.webdeveloperplus.com/uploads/2009/09/jquery-image-gallery/PanelGallery.jpg" alt="" width="620" height="295" /></p>
<h4>8. <a title="Pikachoose" href="http://pikachoose.com/">PikaChoose</a></h4>
<p>Pikachoose allows easy presentation of a bunch of images using slideshows with nice thumbnails, next/prev buttons and autoplay options.</p>
<p><img class="largepostimage" title="Pikachoose" src="http://static.webdeveloperplus.com/uploads/2009/09/jquery-image-gallery/PikaChoose.jpg" alt="" width="447" height="329" /></p>
<h4>9. <a title="jQuery Gallery Plugin" href="http://code.google.com/p/jquery-gallery-plugin/">jQuery Gallery Plugin</a></h4>
<p>This plugin will transform a list of images into a flash like image gallery. Thumbnail navigation only shows up when you hover over the image and behaves like infinite carousel.</p>
<p><img class="largepostimage" title="jQuery Gallery Plugin" src="http://static.webdeveloperplus.com/uploads/2009/09/jquery-image-gallery/jQuery-Gallery-Plugin.jpg" alt="" width="491" height="363" /></p>
<h4>10. <a title="EOGallery" href="http://www.eogallery.com/">EOGallery</a></h4>
<p>EOGallery creates an animated slideshow and images are displayed in larger size using jQuery Thickbox plugin.</p>
<p><img class="largepostimage" title="EOGallery" src="http://static.webdeveloperplus.com/uploads/2009/09/jquery-image-gallery/EOGallery.jpg" alt="" width="620" height="309" /></p>
<h4>11. <a title="Smooth Div Scroll" href="http://www.maaki.com/thomas/SmoothDivScroll/">Smooth Div Scroll</a></h4>
<p>As the name suggests, this plugin scrolls content smoothly and horizontally in either left or right direction. This plugin can scroll any html content and if you use images, you&#8217;ll end up with a nice smoothly scrolling slideshow.</p>
<p><img class="largepostimage" title="Smooth Div Scroll" src="http://static.webdeveloperplus.com/uploads/2009/09/jquery-image-gallery/Smooth-Div-Scroll.jpg" alt="" width="620" height="227" /></p>
<h4>12. <a title="Sliding Image Gallery" href="http://www.meadmiracle.com/SlidingGallery.aspx">Sliding Image Gallery</a></h4>
<p>Sliding image gallery displays a number of images in an easy to use manner just like the iTunes Album Viewer. It is quite easy to implement and gives you a lot of options to customize.</p>
<p><img class="largepostimage" title="Sliding Image Gallery" src="http://static.webdeveloperplus.com/uploads/2009/09/jquery-image-gallery/sliding-image-gallery.jpg" alt="" width="620" height="273" /></p>
<h4>13. <a title="Step Carousel" href="http://www.dynamicdrive.com/dynamicindex4/stepcarousel.htm">Step Carousel Viewer</a></h4>
<p>This plugin displays images or any HTML content by side scrolling them left or right with a smooth sliding animation during transition. And with its two public methods and two custom event handlers, you can customize it to your requirement easily.</p>
<p><img class="largepostimage" title="Step Carousel Viewer" src="http://static.webdeveloperplus.com/uploads/2009/09/jquery-image-gallery/step-carousel-viewer.jpg" alt="" width="603" height="257" /></p>
<h4>14.<a title="jQuery Virtul Tour" href="http://www.openstudio.fr/jquery-virtual-tour/"> jQuery Virtual Tour</a></h4>
<p>With this plugin, you can convert panoramic views into virtual tours, it degrades gracefully if JavaScript is disabled.</p>
<p><img class="largepostimage" title="jQuery Virtual Tour" src="http://static.webdeveloperplus.com/uploads/2009/09/jquery-image-gallery/virtual-tour.jpg" alt="" width="619" height="390" /></p>
<h4>15. <a title="Ultimate Fade In Slide Show" href="http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm">Ultimate Fade In Slide Show</a></h4>
<p>This is a robust, cross browser fade in slideshow script that incorporates some of your most requested features all rolled into one.</p>
<p><img class="largepostimage" title="Ultimate Fade In Slide Show" src="http://static.webdeveloperplus.com/uploads/2009/09/jquery-image-gallery/ultimate-fade-in-slideshow.jpg" alt="" width="320" height="251" /></p>
<h4>16. <a title="Thickbox Gallery" href="http://jquery.com/demo/thickbox/">ThickBox Gallery</a></h4>
<p>jQuery Thickbox plugin can be used for creating a nice image viewer that shows images in a lightbox and supports keyboard shortcuts to navigate through the images.</p>
<p><img class="largepostimage" title="Thickbox Gallery" src="http://static.webdeveloperplus.com/uploads/2009/09/jquery-image-gallery/Thickbox-Gallery.jpg" alt="" width="620" height="391" /></p>
<h4>17. <a title="jQuery Lightbox" href="http://leandrovieira.com/projects/jquery/lightbox/">jQuery Lightbox</a></h4>
<p>This one is a simple elegant and unobtrusive plugin to create an overlay image viewer that supports keyboard shortcuts and requires minimal coding effort.</p>
<p><img class="largepostimage" title="jQuery Lightbox Gallery" src="http://static.webdeveloperplus.com/uploads/2009/09/jquery-image-gallery/lightbox-gallery.jpg" alt="" width="585" height="374" /></p>
<h4>18. <a title="GalleryView" href="http://spaceforaname.com/galleryview">GalleryView</a></h4>
<p>GalleryView lets you create a flexible and attractive content that is very easy to implement and customize. Also, their way of explaining the anatomy of GalleryView plugin is very intuitive.</p>
<p><img class="largepostimage" title="Gallery View" src="http://static.webdeveloperplus.com/uploads/2009/09/jquery-image-gallery/Gallery-View.jpg" alt="" width="620" height="319" /></p>
<h4>19. <a title="Flickr Gallery" href="http://www.userfriendlythinking.com/Blog/BlogDetail.asp?p1=7013&amp;p2=101&amp;p7=3001">Flickr Gallery</a></h4>
<p>Flickr Gallery generates a slideshow whose size varies with the size of image. As the name suggests, it can directly pull images from a flickr account(needs Flickr API key) or you can use just a simple unordered list. Thumbnail navigation is intuitive with a nice scrolling bar.</p>
<p><img class="largepostimage" title="Flickr Gallery" src="http://static.webdeveloperplus.com/uploads/2009/09/jquery-image-gallery/flickr-Gallery.jpg" alt="" width="587" height="380" /></p>
<h4>20.<a title="Easy Slider" href="http://cssglobe.com/post/5780/easy-slider-17-numeric-navigation-jquery-slider">Easy Slider</a></h4>
<p>Easy slider enables images to slide either horizontally or vertically and it can be styled easily using CSS. The latest version of this plugin supports continuous scroll instead of jumping over to first slide from last slide.</p>
<p><img class="largepostimage" title="Easy Slider" src="http://static.webdeveloperplus.com/uploads/2009/09/jquery-image-gallery/easy-slider.jpg" alt="" width="620" height="196" /></p>
<h4>21. <a title="Super Sized" href="http://www.buildinternet.com/project/supersized/">SuperSized</a></h4>
<p>Using Supersized, you can display large sized photos easily as it will scale the images automatically depending on browser size and supports preloading of images for better experience.</p>
<p><img class="largepostimage" title="Supersized" src="http://static.webdeveloperplus.com/uploads/2009/09/jquery-image-gallery/Supersized.jpg" alt="" width="620" height="347" /></p>


<p>Related posts:<ol><li><a href='http://webdeveloperplus.com/flash/25-amazing-free-flash-based-image-galleries/' rel='bookmark' title='Permanent Link: 25 Amazing &#038; Free Flash Based Image Galleries'>25 Amazing &#038; Free Flash Based Image Galleries</a></li>
<li><a href='http://webdeveloperplus.com/jquery/30-fresh-amazing-jquery-plugins-tutorials/' rel='bookmark' title='Permanent Link: 30+ Fresh &#038; Amazing jQuery Plugins &#038; Tutorials'>30+ Fresh &#038; Amazing jQuery Plugins &#038; Tutorials</a></li>
<li><a href='http://webdeveloperplus.com/jquery/15-excellent-jquery-plugins-to-enhance-html-forms/' rel='bookmark' title='Permanent Link: 15+ Excellent jQuery Plugins To Enhance HTML Forms'>15+ Excellent jQuery Plugins To Enhance HTML Forms</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://webdeveloperplus.com/jquery/21-brilliant-jquery-image-galleryslideshow-plugins/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Multiple File Upload With Progress Bar Using jQuery</title>
		<link>http://webdeveloperplus.com/jquery/multiple-file-upload-with-progress-bar-using-jquery/</link>
		<comments>http://webdeveloperplus.com/jquery/multiple-file-upload-with-progress-bar-using-jquery/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 08:41:32 +0000</pubDate>
		<dc:creator>Satbir</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[file upload]]></category>
		<category><![CDATA[jquery plugins]]></category>
		<category><![CDATA[user interface]]></category>

		<guid isPermaLink="false">http://webdeveloperplus.com/?p=351</guid>
		<description><![CDATA[The default browser file input boxes do not allow multiple file selection for uploading at once and also do not provide any visual clue as to how much of the files selected have uploaded. Earlier I wrote about multiple file upload using AJAX, but that did not provide multiple file selection and a progress bar. [...]]]></description>
			<content:encoded><![CDATA[<p>The default browser file input boxes do not allow multiple file selection for uploading at once and also do not provide any visual clue as to how much of the files selected have uploaded. Earlier I wrote about <a href="http://webdeveloperplus.com/jquery/ajax-multiple-file-upload-form-using-jquery/" >multiple file upload using AJAX</a>, but that did not provide multiple file selection and a progress bar. </p>
<p>Today I am going to show you how to create a multiple file upload form that allows multiple file selection using Ctrl/Shift keys and also displays a progress bar for each of the selected files while they are uploading.</p>
<p><a href="http://demo.webdeveloperplus.com/jquery-swfupload/" alt="See the Demo"><img src="http://webdeveloperplus.com/wp-content/uploads/2009/09/multiple-file-upload-with-progress-bar.png" alt="Multiple File Upload With Progress Bar" title="Multiple File Upload With Progress Bar" width="558" height="328" class="largepostimage" /></a></p>
<p>For this tutorial, you will need the all powerful <a href="http://jquery.com/" target="_blank">jQuery library</a>(latest version) and <a href="http://blogs.bigfish.tv/adam/2009/06/14/swfupload-jquery-plugin/" target="_blank">SWFUpload jQuery Plugin</a>.</p>
<h3>Folder Structure</h3>
<p>Place the jQuery library in js folder, extract the SWFUpload jQuery Plugin somewhere and copy the <em>jquery.swfupload.js</em> in the src folder to the js folder. Also, copy the swfupload folder inside vendor folder of SWFUpload jQuery Plugin to js Folder. Here&#8217;s what your folder structure should look like.</p>
<p><img src="http://webdeveloperplus.com/wp-content/uploads/2009/09/Folder-Structure.png" alt="Folder Structure" title="Folder Structure" width="320" height="131" class="alignnone size-full wp-image-356" /></p>
<p>Add reference to jQuery library and then <em>jquery.swfupload.js</em> in the head tag of your page.</p>
<h3>HTML Structure</h3>
<p>Since we will be using SWFUpload, we&#8217;ll need a container that will act as placeholder for SWFUpload button, and a list to show the queue of files. </p>
<pre name="code" class="html" >
&lt;div id=&quot;swfupload-control&quot;&gt;
	&lt;p&gt;Upload upto 5 image files(jpg, png, gif), each having maximum size of 1MB(Use Ctrl/Shift to select multiple files)&lt;/p&gt;
	&lt;input type=&quot;button&quot; id=&quot;button&quot; /&gt;
	&lt;p id=&quot;queuestatus&quot; &gt;&lt;/p&gt;
	&lt;ol id=&quot;log&quot;&gt;&lt;/ol&gt;
&lt;/div&gt;
</pre>
<h3>CSS Styles</h3>
<p>Here are some CSS styles to stylize our File Uploader, modify them as you want. Important ones are .progressbar and .progress that define the progress bar for file upload, you can adjust their height and color.</p>
<pre name="code" class="css" >
#swfupload-control p{ margin:10px 5px; font-size:0.9em; }
#log{ margin:0; padding:0; width:500px;}
#log li{ list-style-position:inside; margin:2px; border:1px solid #ccc; padding:10px; font-size:12px;
	font-family:Arial, Helvetica, sans-serif; color:#333; background:#fff; position:relative;}
#log li .progressbar{ border:1px solid #333; height:5px; background:#fff; }
#log li .progress{ background:#999; width:0%; height:5px; }
#log li p{ margin:0; line-height:18px; }
#log li.success{ border:1px solid #339933; background:#ccf9b9; }
#log li span.cancel{ position:absolute; top:5px; right:5px; width:20px; height:20px;
	background:url('js/swfupload/cancel.png') no-repeat; cursor:pointer; }
</pre>
<h3>The JavaScript Code</h3>
<p>The JavaScript code is a bit bulkier but it is not that difficult to understand as it looks.</p>
<pre name="code" class="js" >
$(function(){
	$('#swfupload-control').swfupload({
		upload_url: &quot;upload-file.php&quot;,
		file_post_name: 'uploadfile',
		file_size_limit : &quot;1024&quot;,
		file_types : &quot;*.jpg;*.png;*.gif&quot;,
		file_types_description : &quot;Image files&quot;,
		file_upload_limit : 5,
		flash_url : &quot;js/swfupload/swfupload.swf&quot;,
		button_image_url : 'js/swfupload/wdp_buttons_upload_114x29.png',
		button_width : 114,
		button_height : 29,
		button_placeholder : $('#button')[0],
		debug: false
	})
		.bind('fileQueued', function(event, file){
			var listitem='&lt;li id=&quot;'+file.id+'&quot; &gt;'+
				'File: &lt;em&gt;'+file.name+'&lt;/em&gt; ('+Math.round(file.size/1024)+' KB) &lt;span class=&quot;progressvalue&quot; &gt;&lt;/span&gt;'+
				'&lt;div class=&quot;progressbar&quot; &gt;&lt;div class=&quot;progress&quot; &gt;&lt;/div&gt;&lt;/div&gt;'+
				'&lt;p class=&quot;status&quot; &gt;Pending&lt;/p&gt;'+
				'&lt;span class=&quot;cancel&quot; &gt;&amp;nbsp;&lt;/span&gt;'+
				'&lt;/li&gt;';
			$('#log').append(listitem);
			$('li#'+file.id+' .cancel').bind('click', function(){ //Remove from queue on cancel click
				var swfu = $.swfupload.getInstance('#swfupload-control');
				swfu.cancelUpload(file.id);
				$('li#'+file.id).slideUp('fast');
			});
			// start the upload since it's queued
			$(this).swfupload('startUpload');
		})
		.bind('fileQueueError', function(event, file, errorCode, message){
			alert('Size of the file '+file.name+' is greater than limit');
		})
		.bind('fileDialogComplete', function(event, numFilesSelected, numFilesQueued){
			$('#queuestatus').text('Files Selected: '+numFilesSelected+' / Queued Files: '+numFilesQueued);
		})
		.bind('uploadStart', function(event, file){
			$('#log li#'+file.id).find('p.status').text('Uploading...');
			$('#log li#'+file.id).find('span.progressvalue').text('0%');
			$('#log li#'+file.id).find('span.cancel').hide();
		})
		.bind('uploadProgress', function(event, file, bytesLoaded){
			//Show Progress
			var percentage=Math.round((bytesLoaded/file.size)*100);
			$('#log li#'+file.id).find('div.progress').css('width', percentage+'%');
			$('#log li#'+file.id).find('span.progressvalue').text(percentage+'%');
		})
		.bind('uploadSuccess', function(event, file, serverData){
			var item=$('#log li#'+file.id);
			item.find('div.progress').css('width', '100%');
			item.find('span.progressvalue').text('100%');
			var pathtofile='&lt;a href=&quot;uploads/'+file.name+'&quot; target=&quot;_blank&quot; &gt;view &amp;raquo;&lt;/a&gt;';
			item.addClass('success').find('p.status').html('Done!!! | '+pathtofile);
		})
		.bind('uploadComplete', function(event, file){
			// upload has completed, try the next one in the queue
			$(this).swfupload('startUpload');
		})
});
</pre>
<p><strong>Code Explanation</strong><br />
Since we are using SWFUpload jQuery Plugin, firstly we initialize it on the placeholder element using the <code>$('#placeholder').swfupload({ settings })</code> function and pass it a settings object that defines various parameters like server side file that will handle uploads, maximum size of the file, number of maximum uploads, allowed file types, button url, button size etc. For complete detail of settings you can use, refer to <a href="http://demo.swfupload.org/Documentation/#settingsobject" title="Settings Object Reference" target="_blank" >SWFUpload docs</a>.</p>
<p>At this stage, your file upload script will work but will not show any visual clue to users about the upload. SWFUpload fires certain events that we can use to provide information to user about the file uploads. So, next thing is to bind functions to various events to show required output. That&#8217;s what all bind calls are doing. They are pretty much self-explanatory.</p>
<h3>Limitations</h3>
<p>Since this script uses SWFUpload to upload files, which requires flash plugin, so this will not work if flash plugin is not installed in end user&#8217;s browser. Make sure to provide an alternative upload form so that users without flash can upload files.</p>
<p>Also, SWFUpload has some known issues when used on linux systems and if user is behind proxies. Make sure to <a href="http://demo.swfupload.org/Documentation/#knownissues" target="_blank">read them</a> before you use it in production environment.</p>
<p><a href="http://demo.webdeveloperplus.com/jquery-swfupload/" title="View Demo" ><strong>View Working Demo</strong></a>  or <a href="http://demo.webdeveloperplus.com/source-code/jquery-swfupload.zip" title="Download Source Code" ><strong>Download Source Code</strong></a></p>


<p>Related posts:<ol><li><a href='http://webdeveloperplus.com/jquery/ajax-multiple-file-upload-form-using-jquery/' rel='bookmark' title='Permanent Link: AJAX Multiple File Upload Form Using jQuery'>AJAX Multiple File Upload Form Using jQuery</a></li>
<li><a href='http://webdeveloperplus.com/jquery/quick-easy-way-to-implement-drag-n-share-with-jquery/' rel='bookmark' title='Permanent Link: Quick &#038; Easy Way to Implement Drag n Share With jQuery'>Quick &#038; Easy Way to Implement Drag n Share With jQuery</a></li>
<li><a href='http://webdeveloperplus.com/jquery/create-flipping-content-tabs-using-jquery/' rel='bookmark' title='Permanent Link: Create Flipping Content Tabs Using jQuery'>Create Flipping Content Tabs Using jQuery</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://webdeveloperplus.com/jquery/multiple-file-upload-with-progress-bar-using-jquery/feed/</wfw:commentRss>
		<slash:comments>38</slash:comments>
		</item>
		<item>
		<title>Collapsible Drag &amp; Drop Panels Using jQuery</title>
		<link>http://webdeveloperplus.com/jquery/collpasible-drag-drop-panels/</link>
		<comments>http://webdeveloperplus.com/jquery/collpasible-drag-drop-panels/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 07:39:22 +0000</pubDate>
		<dc:creator>Satbir</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[drag drop panels]]></category>
		<category><![CDATA[jquery ui]]></category>

		<guid isPermaLink="false">http://webdeveloperplus.com/?p=302</guid>
		<description><![CDATA[Drag n Drop panels are great to let the user control how he/she wants to see the information as he can arrange various information blocks according to his preference. This type of functionality is often provided by web portals or personal homepage services like iGoogle. Similarly, WordPress dashboard also lets user control how the various [...]]]></description>
			<content:encoded><![CDATA[<p>Drag n Drop panels are great to let the user control how he/she wants to see the information as he can arrange various information blocks according to his preference. This type of functionality is often provided by web portals or personal homepage services like iGoogle.<br />
<img src="http://webdeveloperplus.com/wp-content/uploads/2009/08/drag-n-drop-igoogle.png" alt="iGoogle" title="iGoogle" width="523" height="250" class="largepostimage" /><br />
Similarly, WordPress dashboard also lets user control how the various boxes are displayed.<br />
<img src="http://webdeveloperplus.com/wp-content/uploads/2009/08/drag-n-drop-wordpress-panels.png" alt="WordPress Dashboard" title="WordPress Dashboard" width="562" height="239" class="largepostimage" /></p>
<p>Today, i am going to show you how to create collapsible, drag and drop panels easily using jQuery and jQuery UI libraries. Here&#8217;s what the final result will look like.</p>
<p><a href="http://demo.webdeveloperplus.com/drag-drop-panels/"><img src="http://webdeveloperplus.com/wp-content/uploads/2009/08/drag-drop-collapsible-panels.png" alt="Collapsible Drag Drop Panels" title="Collapsible Drag Drop Panels" width="600" height="306" class="largepostimage" /></a></p>
<p>Let&#8217;s begin with it.</p>
<h3>Include The Libraries</h3>
<p>We&#8217;ll be using the all powerful jQuery library and the jQuery UI libraries, so grab the latest version of both and add it to your page header.</p>
<h3>The HTML Structure</h3>
<p>We&#8217;ll be using two vertical columns defined by div with <code>class="column"</code> in this example that will hold our panels. You can increase the number of panels by adjusting the width in the stylesheet for <code>.column</code>.  Each panel is a div with <code>class="dragbox"</code>. And the content of each panel resides within div with <code>class="dragbox-content"</code>.</p>
<p>Here&#8217;s the complete HTML structure for our example, i will be using 5 panels within two columns.</p>
<pre name="code" class="html" >
	&lt;div class=&quot;column&quot; id=&quot;column1&quot;&gt;
		&lt;div class=&quot;dragbox&quot; id=&quot;item1&quot; &gt;
			&lt;h2&gt;Handle 1&lt;/h2&gt;
			&lt;div class=&quot;dragbox-content&quot; &gt;
				&lt;!-- Panel Content Here --&gt;
			&lt;/div&gt;
		&lt;/div&gt;
		&lt;div class=&quot;dragbox&quot; id=&quot;item2&quot; &gt;
			&lt;h2&gt;&lt;span class=&quot;configure&quot; &gt;&lt;a href=&quot;#&quot; &gt;Configure&lt;/a&gt;&lt;/span&gt;Handle 2&lt;/h2&gt;
			&lt;div class=&quot;dragbox-content&quot; &gt;
				&lt;!-- Panel Content Here --&gt;
			&lt;/div&gt;
		&lt;/div&gt;
		&lt;div class=&quot;dragbox&quot; id=&quot;item3&quot; &gt;
			&lt;h2&gt;Handle 3&lt;/h2&gt;
			&lt;div class=&quot;dragbox-content&quot; &gt;
				&lt;!-- Panel Content Here --&gt;
			&lt;/div&gt;
		&lt;/div&gt;
	&lt;/div&gt;
	&lt;div class=&quot;column&quot; id=&quot;column2&quot; &gt;
		&lt;div class=&quot;dragbox&quot; id=&quot;item4&quot; &gt;
			&lt;h2&gt;Handle 4&lt;/h2&gt;
			&lt;div class=&quot;dragbox-content&quot; &gt;
				&lt;!-- Panel Content Here--&gt;
			&lt;/div&gt;
		&lt;/div&gt;
		&lt;div class=&quot;dragbox&quot; id=&quot;item5&quot; &gt;
			&lt;h2&gt;Handle 5&lt;/h2&gt;
			&lt;div class=&quot;dragbox-content&quot; &gt;
				&lt;!--Panel Content Here--&gt;
			&lt;/div&gt;
		&lt;/div&gt;
	&lt;/div&gt;
</pre>
<p>You can add a link to configuration of a panel within the <code>&lt;h2&gt;</code> tag using <code>&lt;span class=&quot;configure&quot;&gt;</code>. This will show up when mouse hovers over the panel header.</p>
<p><strong>Update</strong><br />
Each column now has a unique id and every panel also has a unique id, this will help in saving the order of panels if the user changes them.</p>
<h3>The CSS Styles</h3>
<p>Here are the CSS styles, you can modify it as you wish but remember to adjust the width of <code>.column</code> in case you increase the number of columns.</p>
<pre name="code" class="css" >
.column{
	width:49%;
	margin-right:.5%;
	min-height:300px;
	background:#fff;
	float:left;
}
.column .dragbox{
	margin:5px 2px  20px;
	background:#fff;
	position:relative;
	border:1px solid #ddd;
	-moz-border-radius:5px;
	-webkit-border-radius:5px;
}
.column .dragbox h2{
	margin:0;
	font-size:12px;
	padding:5px;
	background:#f0f0f0;
	color:#000;
	border-bottom:1px solid #eee;
	font-family:Verdana;
	cursor:move;
}
.dragbox-content{
	background:#fff;
	min-height:100px; margin:5px;
	font-family:'Lucida Grande', Verdana; font-size:0.8em; line-height:1.5em;
}
.column  .placeholder{
	background: #f0f0f0;
	border:1px dashed #ddd;
}
.dragbox h2.collapse{
	background:#f0f0f0 url('collapse.png') no-repeat top right;
}
.dragbox h2 .configure{
	font-size:11px; font-weight:normal;
	margin-right:30px; float:right;
}
</pre>
<h3>The JavaScript Code</h3>
<p>To make the boxes draggable and droppable, we&#8217;ll be using the Sortables function of jQuery UI library. Here&#8217; the code you need to use, add this to <code>$(document).ready()</code> function:</p>
<pre name="code" class="js" >
$('.column').sortable({
	connectWith: '.column',
	handle: 'h2',
	cursor: 'move',
	placeholder: 'placeholder',
	forcePlaceholderSize: true,
	opacity: 0.4,
})
.disableSelection();
</pre>
<p><strong>Explanation</strong>: I used some options with sortable function . the first one <code>connectWith</code> lets you move panels across different columns. The <code>handle</code> defines the tag which is used to drag the panel. The <code>placeholder</code> parameter is the CSS class to use for the panel placeholder which is displayed when you drag a panel to show the possible position of the dragged panel. <code>forcePlaceholderSize</code> makes sure that placeholder size is equal to the size of the dragged panel and at last <code>opacity</code> sets the opacity of the panel while dragging.</p>
<p><strong>Collapsing The Panels</strong><br />
To collapse the content of a panel when you click on the panel header and show the configure link on panel header on hover, use the below code in jQuery document ready function.</p>
<pre name="code" class="js" >
$('.dragbox').each(function(){
	$(this).hover(function(){
		$(this).find('h2').addClass('collapse');
	}, function(){
		$(this).find('h2').removeClass('collapse');
	})
	.find('h2').hover(function(){
		$(this).find('.configure').css('visibility', 'visible');
	}, function(){
		$(this).find('.configure').css('visibility', 'hidden');
	})
	.click(function(){
		$(this).siblings('.dragbox-content').toggle();
	})
	.end()
	.find('.configure').css('visibility', 'hidden');
});
</pre>
<p>One thing you&#8217;ll notice after adding this code is that when you drag the panel, the content of the panel toggles as when you drag the click event of panel header also fires that toggles the state of content. To fix this, you need to add another parameter to sortable so that when drag is finished, state of content does not toggle.</p>
<pre name="code" class="js" >
$('.column').sortable({
	connectWith: '.column',
	handle: 'h2',
	cursor: 'move',
	placeholder: 'placeholder',
	forcePlaceholderSize: true,
	opacity: 0.4,
	stop: function(event, ui){
		$(ui.item).find('h2').click();
	}
})
.disableSelection();
</pre>
<p>Here i added another parameter stop that defines the function to use when drag is complete. Once the drag is complete, click event of panel header is fired so that the original state of content is restored.</p>
<h3>Saving State</h3>
<p><em>Update (Sep 16, 2009)</em><br />
Many of the commentors below asked about how to save the state of panels. I have written a follow up post on <a href="http://webdeveloperplus.com/jquery/saving-state-for-collapsible-drag-drop-panels/">how to save state using database</a>. Be sure to check it if you want to know.</p>
<p>There you are with nice multi-column collapsible drag drop panels.</p>
<p><a href="http://demo.webdeveloperplus.com/drag-drop-panels/" ><strong>See the Working Demo</strong></a> or <a href="http://demo.webdeveloperplus.com/source-code/drag-drop-panels.zip" ><strong>Download source code &#038; try</strong></a>.</p>


<p>Related posts:<ol><li><a href='http://webdeveloperplus.com/jquery/saving-state-for-collapsible-drag-drop-panels/' rel='bookmark' title='Permanent Link: Saving State For Collapsible Drag Drop Panels'>Saving State For Collapsible Drag Drop Panels</a></li>
<li><a href='http://webdeveloperplus.com/jquery/featured-content-slider-using-jquery-ui/' rel='bookmark' title='Permanent Link: Create Featured Content Slider Using jQuery UI'>Create Featured Content Slider Using jQuery UI</a></li>
<li><a href='http://webdeveloperplus.com/jquery/quick-easy-way-to-implement-drag-n-share-with-jquery/' rel='bookmark' title='Permanent Link: Quick &#038; Easy Way to Implement Drag n Share With jQuery'>Quick &#038; Easy Way to Implement Drag n Share With jQuery</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://webdeveloperplus.com/jquery/collpasible-drag-drop-panels/feed/</wfw:commentRss>
		<slash:comments>50</slash:comments>
		</item>
		<item>
		<title>30+ Fresh &amp; Amazing jQuery Plugins &amp; Tutorials</title>
		<link>http://webdeveloperplus.com/jquery/30-fresh-amazing-jquery-plugins-tutorials/</link>
		<comments>http://webdeveloperplus.com/jquery/30-fresh-amazing-jquery-plugins-tutorials/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 08:03:55 +0000</pubDate>
		<dc:creator>Satbir</dc:creator>
				<category><![CDATA[Popular]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jquery effects]]></category>
		<category><![CDATA[jquery plugins]]></category>

		<guid isPermaLink="false">http://webdeveloperplus.com/?p=277</guid>
		<description><![CDATA[jQuery is slowly becoming ubiquitous in the web development arena all due to its easy to learn, easy to use and easy to extend nature. Here are 30+ fresh and amazing jQuery plugins and tutorials which i have hand-picked from jQuery articles or plugins published in last 30 days on the interwebs. If you are looking for latest on jQuery, then this is a must read for you.]]></description>
			<content:encoded><![CDATA[<p>jQuery is slowly becoming ubiquitous in the web development arena all due to its easy to learn, easy to use and easy to extend nature. Here are 30+ fresh and amazing jQuery plugins and tutorials which i have hand-picked from jQuery articles or plugins published in last 30 days on the interwebs. If you are looking for latest on jQuery, then this is a must read for you.</p>
<h3>Tutorials</h3>
<h4 class="clear">1. <a href="http://hungred.com/2009/08/10/how-to/tutorial-how-to-add-preloader-loading-image-gallery-jquery/">How to add preloader with loading image in a gallery using jQuery</a></h4>
<p><img class="largepostimage" src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/jquery-image-preloader.jpg" alt="" width="603px" height="250px" /><br />
Use a jQuery preloader while images are loading in the gallery.<br />
<a href="http://hungred.com/wp-content/demo/jQuery-preloading-with-image/demo.html">» View Demo</a> | <a href="http://hungred.com/2009/08/10/how-to/tutorial-how-to-add-preloader-loading-image-gallery-jquery/">» View Tutorial</a></p>
<h4>2. <a href="http://www.queness.com/post/530/simple-lava-lamp-menu-tutorial-with-jquery" >Simple Lava Lamp Menu Tutorial With jQuery</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/lava-lamp-jquery.jpg" class="largepostimage" width="559px" height="71px" /><br />
Create a unique lava lamp animated jQuery navigation menu<br />
<a href="http://www.queness.com/resources/html/lava/style.html" >» View Demo</a> &#124; <a href="http://www.queness.com/post/530/simple-lava-lamp-menu-tutorial-with-jquery" >» View Tutorial</a></p>
<h4>3. <a href="http://www.devirtuoso.com/2009/08/how-to-create-a-3d-tag-cloud-in-jquery/" >How To Create a 3D Tag Cloud in jQuery</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/3d-tag-cloud-jquery.jpg" class="alignleft size-full wp-image-284" width="203px" height="200px" /><br />
Amazing tutorial on creating a flash like 3D tag cloud using jQuery.<br />
<a href="http://www.devirtuoso.com/Examples/3D-jQuery/" >» View Demo</a> &#124; <a href="http://www.devirtuoso.com/2009/08/how-to-create-a-3d-tag-cloud-in-jquery/" >» View Tutorial</a></p>
<h4 class="clear">4. <a href="http://papermashup.com/drag-drop-with-php-jquery/" >Drag &#038; Drop With jQuery</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/drag-drop-jquery.png" class="largepostimage" width="381px" height="178px" /><br />
Drag &#038; Drop facility in a web application provides for a rich user interface, learn how to create one using jQuery UI.<br />
<a href="http://papermashup.com/demos/jquery-drag-drop/" >» View Demo</a> &#124; <a href="http://papermashup.com/drag-drop-with-php-jquery/" >» View Tutorial</a></p>
<h4>5. <a href="http://aext.net/2009/08/kwicks-for-jquery-and-an-awesome-horizontal-animated-menu/" >Awesome Horizontal Animated menu using Kwicks for jQuery</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/kwicks-horizontal-menu.png" class="largepostimage" width="524px" height="66px" /><br />
Build a customizable and versatile horizontal animated menu using jQuery Kwicks plugin.<br />
<a href="http://aext.net/example/kwicksmenu/" >» View Demo</a> &#124; <a href="http://aext.net/2009/08/kwicks-for-jquery-and-an-awesome-horizontal-animated-menu/" >» View Tutorial</a></p>
<h4>6. <a href="http://www.queness.com/post/484/create-a-thumbnail-gallery-with-slick-heading-and-caption-effect-with-jquery" >Create a Thumbnail Gallery With Slick Heading &#038; Caption effect</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/slick-thumbnail-caption.jpg" class="largepostimage" width="364px" height="248px" /><br />
<a href="http://www.queness.com/resources/html/caption/index.html" >» View Demo</a> &#124; <a href="http://www.queness.com/post/484/create-a-thumbnail-gallery-with-slick-heading-and-caption-effect-with-jquery" >» View Tutorial</a></p>
<h4>7. <a href="http://www.queness.com/post/411/create-an-attractive-jquery-menu-with-fadein-and-fadeout-effect" >Create an Attractive jQuery Menu with fade in and out effects</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/fade-in-out-jquery-menu.jpg" class="largepostimage" width="372px" height="79px" /><br />
Nice tutorial on creating an attractive jquery menu with fade in background change on hover.<br />
<a href="http://www.queness.com/resources/html/fadein/index.html" >» View Demo</a> &#124; <a href="http://www.queness.com/post/411/create-an-attractive-jquery-menu-with-fadein-and-fadeout-effect" >» View Tutorial</a></p>
<h4>8. <a href="http://papermashup.com/jquery-php-ajax-autosuggest/" >jQuery PHP AJAX Autosuggest</a></h4>
<p><img src="http://webdeveloperplus.com/wp-content/uploads/2009/08/autosuggest-php-jquery.jpg" alt="jQuery PHP AJAX Autosuggest" title="jQuery PHP AJAX Autosuggest" width="257" height="193" class="alignleft size-full wp-image-284" /> Autosuggest is one of the useful features of present web applications. Learn how to create one using jQuery and PHP.<br />
<a href="http://papermashup.com/demos/autosuggest/" >» View Demo</a> &#124; <a href="http://papermashup.com/jquery-php-ajax-autosuggest/" >» View Tutorial</a></p>
<h4 class="clear">9. <a href="http://aext.net/2009/08/perfect-login-dropdown-box-likes-twitter-with-jquery/" >Perfect Login Drop Down Box Like Twitter</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/twitter-sign-in-box-jquery.png" class="largepostimage" width="396px" height=246"px" /><br />
Nice tutorial on imitating the new twitter login dropdown box using jquery.<br />
<a href="http://aext.net/example/twitterlogin/" >» View Demo</a> &#124; <a href="http://aext.net/2009/08/perfect-login-dropdown-box-likes-twitter-with-jquery/" >» View Tutorial</a></p>
<h4>10. <a href="http://buildinternet.com/2009/08/crafting-an-animated-postcard-with-jquery/" >Crafting an Animated Postcard With jQuery</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/flashy-postcard.jpg" class="largepostimage" width="599px" height="262px" /><br />
Create a flashy postcard using just jQuery and no flash.<br />
<a href="http://buildinternet.com/live/postcard" >» View Demo</a> &#124; <a href="http://buildinternet.com/2009/08/crafting-an-animated-postcard-with-jquery/" >» View Tutorial</a></p>
<h4>11. <a href="http://9lessons.blogspot.com/2009/08/twitter-like-search-with-jquery-ajax.html" >Twitter like Search With jQuery &#038; AJAX</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/twitter-like-search.png" class="largepostimage" width="416px" height="151px" /><br />
Create a twitter like search box that loads results using AJAX on same page.<br />
<a href="http://9lessons.net63.net/newsearch.php" >» View Demo</a> &#124; <a href="http://9lessons.blogspot.com/2009/08/twitter-like-search-with-jquery-ajax.html" >» View Tutorial</a></p>
<h4>12. <a href="http://9lessons.blogspot.com/2009/08/vote-with-jquery-ajax-and-php.html" >Voting System With jQuery, AJAX, PHP</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/dzone-voting-ajax.png" class="largepostimage" width="467px" height="97px" /><br />
Learn how to create <a href="http://dzone.com/" target="_blank" >dzone</a> like voting system.<br />
<a href="http://9lessons.net63.net/voting.php" >» View Demo</a> &#124; <a href="http://9lessons.blogspot.com/2009/08/vote-with-jquery-ajax-and-php.html" >» View Tutorial</a></p>
<h4>13. <a href="http://www.webresourcesdepot.com/ajaxed-sliding-shopping-cart-with-jquery/" >AJAXed Sliding Shopping Cart Using jQuery</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/sliding-ajax-shopping-cart.png" class="largepostimage" width="473px" height="172px" /><br />
Amazing tutorial on creating a sliding AJAX Shopping basket that slides in and updates the cart when new item is added and auto-hides after some time. It also supports manual show hide option to view shopping cart at any time.<br />
<a href="http://webresourcesdepot.com/wp-content/uploads/file/jbasket/sliding-basket/" >» View Demo</a> &#124; <a href="http://www.webresourcesdepot.com/ajaxed-sliding-shopping-cart-with-jquery/" >» View Tutorial</a></p>
<h4>14. <a href="http://www.devirtuoso.com/2009/07/how-to-build-an-animated-header-in-jquery/" >How To Build Animated Header in jQuery</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/animated-header-jquery.jpg" class="largepostimage" width="553px" height="237px" /><br />
Add motion to your header by animating its background. Amazing animation tutorial using jQuery.<br />
<a href="http://www.devirtuoso.com/Examples/jQuery-Animated-Header/" >» View Demo</a> &#124; <a href="http://www.devirtuoso.com/2009/07/how-to-build-an-animated-header-in-jquery/" >» View Tutorial</a></p>
<h4>15. <a href="http://9lessons.blogspot.com/2009/07/hide-and-seek-with-jquery.html" >Hide and Seek With jQuery</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/hide-seek-jquery.png" class="largepostimage" width="437px" height="162px" /><br />
Use jQuery to display multiple modules of an application on a single page based on the event occurred.<br />
<a href="http://9lessons.net63.net/hidejquery.html" >» View Demo</a> &#124; <a href="http://9lessons.blogspot.com/2009/07/hide-and-seek-with-jquery.html" >» View Tutorial</a></p>
<h4>16. <a href="http://davidwalsh.name/jquery-comment-preview" >jQuery Comment Preview</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/comment-preview-jquery.png" class="largepostimage" width="600px" height="204px" /><br />
Provide comment preview to your users as they type in their comment using jQuery.<br />
<a href="http://davidwalsh.name/dw-content/jquery-live-preview.php" >» View Demo</a> &#124; <a href="http://davidwalsh.name/jquery-comment-preview" >» View Tutorial</a></p>
<h4>17. <a href="http://www.devirtuoso.com/2009/08/styling-drop-down-boxes-with-jquery/" >Styling Drop Down Boxes With jQuery</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/style-select-box.png" class="alignleft size-full wp-image-284" width="204px" height="126px" /><br />
Since select boxes are hard to style using CSS, this tutorial shows you how to replace a select box with a textbox and an unordered list and then style them according to your choice.<br />
<a href="http://www.devirtuoso.com/Examples/Styling-Dropdown/" >» View Demo</a> &#124; <a href="http://www.devirtuoso.com/2009/08/styling-drop-down-boxes-with-jquery/" >» View Tutorial</a></p>
<h4 class="clear">18. <a href="http://webdeveloperplus.com/jquery/create-a-dynamic-scrolling-content-box-using-ajax/" >Scrolling Dynamic Content Box</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/dynamic-content-on-scroll.png" class="largepostimage" width="441px" height="254px" /><br />
Load content into a div on scroll using AJAX just like Google reader loads more items as you scroll down to view more items of a feed.<br />
<a href="http://demo.webdeveloperplus.com/dynamic-scrollbox/" >» View Demo</a> &#124; <a href="http://webdeveloperplus.com/jquery/create-a-dynamic-scrolling-content-box-using-ajax/" >» View Tutorial</a></p>
<h4>19. <a href="http://hungred.com/2009/08/04/useful-information/ways-debug-jquery-javascript-codes/" >Ways To Debug your jQuery or JavaScript Code</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/debug-javascript-jquery.png" class="largepostimage" width="520px" height="171px" /><br />
This article explains how you can easily debug javascript code using jquery console logging.<br />
<a href="http://hungred.com/2009/08/04/useful-information/ways-debug-jquery-javascript-codes/" >» View Tutorial</a></p>
<h4>20. <a href="http://net.tutsplus.com/tutorials/javascript-ajax/5-ways-to-make-ajax-calls-with-jquery/" >5 Ways To Make AJAX Calls with jQuery</a></h4>
<p>Nice tutorial from NetTuts+ about different ways of making AJAX calls using jQuery. It is even useful for those who are already familiar with jQuery as in depth coverage of various methods of making AJAX calls has been done.<br />
<a href="http://nettuts.s3.amazonaws.com/412_ajaxCalls/DEMO/index.htm" >» View Demo</a> &#124; <a href="http://net.tutsplus.com/tutorials/javascript-ajax/5-ways-to-make-ajax-calls-with-jquery/" >» View Tutorial</a><br />
<br class="clear" /></p>
<h3>Plugins</h3>
<h4>1. <a href="http://onehackoranother.com/projects/jquery/tipsy/" >Tipsy</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/tipsy.png" class="alignleft" width="198px" height="66px" /><br />
Display Facebook style tooltip plugins based on anchor tag&#8217;s title attribute<br />
<a href="http://onehackoranother.com/projects/jquery/tipsy/#examples" >» View Demo</a> &#124; <a href="http://onehackoranother.com/projects/jquery/tipsy/" >» Plugin Page</a></p>
<h4 class="clear">2. <a href="http://www.geckonewmedia.com/blog/2009/8/14/jquery-youtube-playlist-plugin---youtubeplaylist" >jQuery YouTube PlayList</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/youtube-playlist.jpg" class="largepostimage" width="600px" height="279px" /><br />
Convert a list of YouTube links into playlist which allows user to see videos right on the page itself.<br />
<a href="http://geckohub.com/jquery/youtubeplaylist/" >» View Demo</a> &#124; <a href="http://www.geckonewmedia.com/blog/2009/8/14/jquery-youtube-playlist-plugin---youtubeplaylist" >» Plugin Page</a></p>
<h4>3. <a href="http://www.electrictoolbox.com/jquery-superfish-menus-plugin/" >SuperFish Menus</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/suckerfish-menu-jquery.png" class="largepostimage" width="414px" height="150px" /><br />
Superfish Menus is an easy to use jquery plugin that converts unordered HTML lists into nice drop down menus.<br />
<a href="http://www.electrictoolbox.com/jquery-superfish-menus-plugin/" >» Plugin Page</a></p>
<h4>4. <a href="http://www.unwrongest.com/projects/elastic/" >Elastic</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/elastic.png" class="largepostimage" width="563px" height="235px" /><br />
Elastic is a lightweight jQuery plugin that makes textareas adjust their size according to the size of content.<br />
<a href="http://www.unwrongest.com/projects/elastic/#demo" >» View Demo</a> &#124; <a href="http://www.unwrongest.com/projects/elastic/" >» Plugin Page</a></p>
<h4>5. <a href="http://azoffdesign.com/plugins/js/overscroll" >OverScroll</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/overscroll.png" class="alignleft" width="116px" height="138px" /><br />
Implement iphone like click and drag to scroll behavior on your web page.<br />
<a href="http://azoffdesign.com/plugins/js/overscroll" >» Plugin Page</a></p>
<h4 class="clear">6. <a href="http://theodin.co.uk/blog/javascript/tweetable-jquery-plugin.html" >Tweetable</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/tweetable.png" class="largepostimage" width="389px" height="132px" /><br />
Display Twitter feed on your website easily and quickly with tweetable. Gives you option to convert twitter usernames and URLs into hyperlinks<br />
<a href="http://theodin.co.uk/tools/tutorials/jqueryTutorial/plugins/tweetable/" >» View Demo</a> &#124; <a href="http://theodin.co.uk/blog/javascript/tweetable-jquery-plugin.html" >» Plugin Page</a></p>
<h4>7. <a href="http://davidwalsh.name/jquery-link-nudge" >jQuery Link nudge</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/jquery-link-nudge.png" class="alignleft" width="254px" height="132px" /><br />
Make links notorious just like ones on David Walsh blog using this jQuery Link Nudge plugin.<br />
<a href="http://davidwalsh.name/dw-content/jquery-link-nudge-plugin.php" >» View Demo</a> &#124; <a href="http://davidwalsh.name/jquery-link-nudge" >» Plugin Page</a></p>
<h4 class="clear">8. <a href="http://haineault.com/media/jquery/ui-timepickr/page/" >TimePickr</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/timepicker.png" class="largepostimage" width="406px" height="124px" /><br />
If you need to get time as input from user, then use this plugin to provide a rich UI to input time.<br />
<a href="http://haineault.com/media/jquery/ui-timepickr/page/" >» Plugin Page</a></p>
<h4>9. <a href="http://theodin.co.uk/blog/development/truncatable-jquery-plugin.html" >Truncatable</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/truncatable.png" class="largepostimage" width="328px" height="92px" /><br />
Truncatable lets you hide blocks of text on page and show them if user requires.<br />
<a href="http://theodin.co.uk/tools/tutorials/jqueryTutorial/plugins/truncatable/" >» View Demo</a> &#124; <a href="http://theodin.co.uk/blog/development/truncatable-jquery-plugin.html" >» Plugin Page</a></p>
<h4>10. <a href="http://plugins.jquery.com/project/AddIncSearch" >Incremental Search For Select Boxes</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/incremental-search.png" class="largepostimage" width="429px" height="193px" /><br />
This plugin converts ordinary select boxes into combo boxes with incremental search, very useful if you have lots of options in the select box.<br />
<a href="http://oss.oetiker.ch/jquery/jquery.AddIncSearch.html" >» View Demo</a> &#124; <a href="http://plugins.jquery.com/project/AddIncSearch" >» Plugin Page</a></p>
<h4>11. <a href="http://css-tricks.com/anythingslider-jquery-plugin/" >Anything Slider</a></h4>
<p><img src="http://static.webdeveloperplus.com/uploads/2009/08/fresh-jquery-tutorials/Anything-Slider.jpg" class="largepostimage" width="600px" height="291px" /><br />
Anything Slider is a full featured slider that is pretty easy to customize and adapt into your website.<br />
<a href="http://css-tricks.com/examples/AnythingSlider/" >» View Demo</a> &#124; <a href="http://css-tricks.com/anythingslider-jquery-plugin/" >» Plugin Page</a></p>


<p>Related posts:<ol><li><a href='http://webdeveloperplus.com/jquery/15-excellent-jquery-plugins-to-enhance-html-forms/' rel='bookmark' title='Permanent Link: 15+ Excellent jQuery Plugins To Enhance HTML Forms'>15+ Excellent jQuery Plugins To Enhance HTML Forms</a></li>
<li><a href='http://webdeveloperplus.com/jquery/15-jquery-tutorials-for-more-interactive-navigation/' rel='bookmark' title='Permanent Link: 15 jQuery Tutorials For More Interactive Navigation'>15 jQuery Tutorials For More Interactive Navigation</a></li>
<li><a href='http://webdeveloperplus.com/jquery/21-brilliant-jquery-image-galleryslideshow-plugins/' rel='bookmark' title='Permanent Link: 21 Brilliant jQuery Image Gallery/Slideshow Plugins'>21 Brilliant jQuery Image Gallery/Slideshow Plugins</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://webdeveloperplus.com/jquery/30-fresh-amazing-jquery-plugins-tutorials/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>New WordPress Plugin: WDP AJAX Comments</title>
		<link>http://webdeveloperplus.com/wordpress/new-wordpress-plugin-wdp-ajax-comments/</link>
		<comments>http://webdeveloperplus.com/wordpress/new-wordpress-plugin-wdp-ajax-comments/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 13:28:57 +0000</pubDate>
		<dc:creator>Satbir</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[ajax comments]]></category>
		<category><![CDATA[wordpress plugins]]></category>

		<guid isPermaLink="false">http://webdeveloperplus.com/?p=242</guid>
		<description><![CDATA[Today, I am proud to release my first WordPress plugin named &#8220;WDP AJAX Comments&#8221;. This plugin will enable AJAX Comments on your WordPress Blog and enhance the user experience using nifty on page comment form submission and validation of input before submission. Features Enable AJAX Commenting Client Side Form Validation Easily rolls back if JS [...]]]></description>
			<content:encoded><![CDATA[<p>Today, I am proud to release my first WordPress plugin named <strong>&#8220;WDP AJAX Comments&#8221;</strong>. This plugin will enable <a href="http://webdeveloperplus.com/wordpress/how-to-ajaxify-wordpress-comment-posting/">AJAX Comments</a> on your WordPress Blog and enhance the user experience using nifty on page comment form submission and validation of input before submission.<br />
<span id="more-242"></span></p>
<h3>Features</h3>
<ul>
<li>Enable AJAX Commenting</li>
<li>Client Side Form Validation</li>
<li>Easily rolls back if JS disabled</li>
<li>Easily configure custom styles for messages</li>
</ul>
<h3>Download</h3>
<p><a href="http://wordpress.org/extend/plugins/wdp-ajax-comments/" ><strong>Download the Plugin</strong></a> from official WordPress Plugin repository.</p>
<h3>Installing &#038; Activating</h3>
<p>Here&#8217;s how to install and use this plugin to its full potential:<br />
1. Firstly, go to <em>Add New Plugin</em> in your WordPress admin panel, and search for <em>wdp ajax comments</em> and you&#8217;ll see the listing, install the plugin by clicking on <em>&#8216;Install&#8217;</em>. Or you can go to <a href="http://wordpress.org/extend/plugins/wdp-ajax-comments/" target="_blank">WordPress plugin repository page</a> and download the plugin and extract it in your <em>wp-content/plugins</em> folder.<br />
2. Now activate this plugin, and your blog is ready with AJAX comment posting, but one thing you still need to do is enabling the client side comment form validation.<br />
3. To enable form validation, refer to the below section.</p>
<h3>Enabling Comment Form Validation</h3>
<p>This plugin makes use of jQuery Validation plugin to validate comment form, so you will need to add some css classes to your comment form. Here&#8217;s how to do that:<br />
1. Open up your theme&#8217;s <strong>comments.php</strong> file in an editor.<br />
2. Find out the code lines where comment form starts.<br />
3. Now, you need to add following CSS classes to comment form inputs:</p>
<ul>
<li>To comment author name input, add <code>class="required"</code></li>
<li>To comment author email input, add <code>class="required email"</code></li>
<li>To comment author URL input, add <code>class="url"</code></li>
<li>To the comment textarea, add <code>class="required"</code></li>
</ul>
<p><img src="http://webdeveloperplus.com/wp-content/uploads/2009/08/ajax-comments-wordpress.png" alt="modify comment form" title="modify comment form" width="635" height="202" class="largepostimage" /></p>
<p>4. Save the file and now your comment form validation will work.</p>
<h3>Styling The Messages</h3>
<p>WDP AJAX Comments provides you with full control over the looks of various messages using CSS. To define your own styles, create a new stylesheet file named <em>wdp-ajax-styles.css</em> in your theme&#8217;s folder and define styles for these classes:</p>
<ul>
<li><code>.wdpajax-error</code> This class is used for the message shown when AJAX error is encountered.</li>
<li><code>.wdpajax-success</code> This class is used for success message shown after successful comment submission.</li>
<li><code>.wdpajax-loading</code> This class is used to show the &#8216;Processing..&#8217; message while performing AJAX request. You can add animated loading gif&#8217;s as background to give a nice AJAX effect.</li>
<li><code>label.error</code> This class is used to show validation errors.</li>
</ul>
<p>If your theme folder does not contain <em>wdp-ajax-styles.css</em> file, the default stylesheet of the plugin will be used.</p>
<h3>Demo</h3>
<p>If you would like to see the demo, go to the <a href="http://demo.webdeveloperplus.com/wordpress/" title="View Demo" target="_blank" ><strong>demo page</strong></a>.</p>
<h3>What to Expect in Coming Versions</h3>
<p>Currently, this plugin just AJAXifies comment submission and does not update the comments displayed automatically. So, this is one of the feature you should expect in coming editions. Another feature i have thought is giving you control over the messages displayed on AJAX requests.</p>
<p>If you would like to suggest a new feature, feel free to comment below, just prepend your comment with <strong>Suggestion</strong>.</p>
<p>If you have used this plugin on your blog, post the address of your blog too, so that other can have a look.<br />
In case you need any assistance, feel free to use the comment section below</p>


<p>Related posts:<ol><li><a href='http://webdeveloperplus.com/wordpress/how-to-ajaxify-wordpress-comment-posting/' rel='bookmark' title='Permanent Link: How To: AJAXify WordPress Comment Posting'>How To: AJAXify WordPress Comment Posting</a></li>
<li><a href='http://webdeveloperplus.com/design/10-ways-to-make-your-blogs-comment-form-stand-out/' rel='bookmark' title='Permanent Link: 10 Ways To Make Your Blog&#8217;s Comment Form Stand Out'>10 Ways To Make Your Blog&#8217;s Comment Form Stand Out</a></li>
<li><a href='http://webdeveloperplus.com/jquery/ajax-multiple-file-upload-form-using-jquery/' rel='bookmark' title='Permanent Link: AJAX Multiple File Upload Form Using jQuery'>AJAX Multiple File Upload Form Using jQuery</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://webdeveloperplus.com/wordpress/new-wordpress-plugin-wdp-ajax-comments/feed/</wfw:commentRss>
		<slash:comments>41</slash:comments>
		</item>
		<item>
		<title>How To: AJAXify WordPress Comment Posting</title>
		<link>http://webdeveloperplus.com/wordpress/how-to-ajaxify-wordpress-comment-posting/</link>
		<comments>http://webdeveloperplus.com/wordpress/how-to-ajaxify-wordpress-comment-posting/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 12:51:13 +0000</pubDate>
		<dc:creator>Satbir</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[ajax comments]]></category>
		<category><![CDATA[wordpress hacks]]></category>
		<category><![CDATA[wordpress plugin]]></category>

		<guid isPermaLink="false">http://webdeveloperplus.com/?p=226</guid>
		<description><![CDATA[There are tons of WordPress Tutorials out there, but i haven&#8217;t found a single one that explains how to AJAX-ify WordPress comment posting on blog posts. Though there are some plugins for AJAX comments, but none seem to work with WordPress 2.8 or later versions. Today i will show you how to enable AJAX comments [...]]]></description>
			<content:encoded><![CDATA[<p>There are tons of WordPress Tutorials out there, but i haven&#8217;t found a single one that explains how to AJAX-ify WordPress comment posting on blog posts. Though there are some plugins for AJAX comments, but none seem to work with WordPress 2.8 or later versions. </p>
<p>Today i will show you how to enable AJAX comments with client side JavaScript comment form validation on your WordPress blog step by step that should work with most versions of WordPress. We&#8217;ll be modifying the WordPress theme files to do that. In few days, i&#8217;ll be releasing a WordPress plugin that will automatically enable AJAX Comments. So, do subscribe to our <a href="http://feeds2.feedburner.com/WebDeveloperPlus" title="Subscribe via RSS" >RSS Feed</a> or <a href="http://feedburner.google.com/fb/a/mailverify?uri=WebDeveloperPlus&#038;loc=en_US" target="_blank" >e-mail updates</a> so that you are the first to know about it.</p>
<p>Let&#8217;s start with it.</p>
<h3>Functions.php file</h3>
<p>Add the following lines of code to your theme&#8217;s <em>functions.php</em> file. If your theme doesn&#8217;t have one, then create a new file and add it to your theme folder.</p>
<pre name="code" class="php" >
add_action('init', 'wdp_ajaxcomments_load_js', 10);
function wdp_ajaxcomments_load_js(){
		wp_enqueue_script('ajaxValidate', get_stylesheet_directory_uri().'/wdp-ajaxed-comments/js/jquery.validate.min.js', array('jquery'), '1.5.5');
		wp_enqueue_script('ajaxcomments', get_stylesheet_directory_uri().'/wdp-ajaxed-comments/js/ajax-comments.js',	array('jquery', 'ajaxValidate'), '1.1');
}
add_action('comment_post', 'wdp_ajaxcomments_stop_for_ajax',20, 2);
function wdp_ajaxcomments_stop_for_ajax($comment_ID, $comment_status){
	if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) &amp;&amp; strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){
	//If AJAX Request Then
		switch($comment_status){
			case '0':
				//notify moderator of unapproved comment
				wp_notify_moderator($comment_ID);
			case '1': //Approved comment
				echo &quot;success&quot;;
				$commentdata=&amp;get_comment($comment_ID, ARRAY_A);
				$post=&amp;get_post($commentdata['comment_post_ID']); //Notify post author of comment
				if ( get_option('comments_notify') &amp;&amp; $commentdata['comment_approved'] &amp;&amp; $post-&gt;post_author != $commentdata['user_ID'] )
					wp_notify_postauthor($comment_ID, $commentdata['comment_type']);
				break;
			default:
				echo &quot;error&quot;;
		}
		exit;
	}
}
</pre>
<p><strong>Code Explanation</strong>: Firstly, we load required JavaScript files jQuery, jQuery Validation and ajax-comments.js using the <code>wp_enqueue_script()</code> function. <code>wp_enqueue_script()</code> accepts four parameters.</p>
<ul>
<li>First is the name of the handler for JavaScript file, you can use any name here for your own custom JavaScript, but for files that wordpress include by default like jQuery, there are pre-fixed handlers like &#8216;jquery&#8217;.</li>
<li>Second parameter is path to JavaScript file.</li>
<li>Third parameter is the array of name of handlers of JavaScript files, which must be loaded before the specified file.</li>
<li>Last is the version number of JavaScript file which you should use in case you use caching on your blog.</li>
</ul>
<p>The function <code>wdp_ajaxcomments_stop_for_ajax()</code> hooks onto the comment_post action which is triggered after a comment has been successfully added to the database. normally, what happens when you post a comment is that you are redirected back to the original post, but since we will be using AJAX, we don&#8217;t want a redirect but a message about the status of comment posted.</p>
<p>I recently read a nice post from David Walsh where he told about <a href="http://davidwalsh.name/detect-ajax" target="_blank">how to identify AJAX requests</a> using <code>$_SERVER["HTTP_X_REQUESTED_WITH"]</code> which is populated by most JavaScript frameworks like in our case jQuery.<br />
I used it to hook into <code>comment_post</code> and check whether it is AJAX request or normal request. If it is AJAX request then check the status of comment, if it is unapproved or approved, a message <em>&#8216;success&#8217;</em> is output and moderator or post author is notified accordingly.<br />
After identifying AJAX request, i stopped the script execution using <code>exit</code> statement so as to prevent the redirect.<br />
Now rest is the job of JavaScript code.</p>
<h3>The JavaScript Code</h3>
<p>You will need to add two JavaScript files <em>jquery.validate.min.js</em> and <em>ajax-comments.js</em> in the <em>js</em> directory of your theme(Files are available at the end of article). Create the <em>js</em> directory and add files if it does not exist. Though jQuery is required to work, but since it is included in WordPress by default, it will automatically be loaded as we specified it as a requirement while loading JavaScript files in <em>functions.php</em>.</p>
<p><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/" target="_blank">jQuery Validation plugin</a> is used to validate comment form data.<br />
Here&#8217;s the code and explanation for <em>ajax-comments.js</em>.</p>
<pre name="code" class="js" >
jQuery('document').ready(function($){
	var commentform=$('form[action$=wp-comments-post.php]');
	commentform.prepend('&lt;div id=&quot;wdpajax-info&quot; &gt;&lt;/div&gt;');
	var infodiv=$('#wdpajax-info');
	commentform.validate({
		submitHandler: function(form){
			//serialize and store form data in a variable
			var formdata=commentform.serialize();
			//Add a status message
			infodiv.html('&lt;p&gt;Processing...&lt;/p&gt;');
			//Extract action URL from commentform
			var formurl=commentform.attr('action');
			//Post Form with data
			$.ajax({
				type: 'post',
				url: formurl,
				data: formdata,
				error: function(XMLHttpRequest, textStatus, errorThrown){
					infodiv.html('&lt;p class=&quot;wdpajax-error&quot; &gt;You might have left one of the fields blank.&lt;/p&gt;');
				},
				success: function(data, textStatus){
					if(data==&quot;success&quot;)
						infodiv.html('&lt;p class=&quot;wdpajax-success&quot; &gt;Thanks for your comment. We appreciate your response.&lt;/p&gt;');
					else
						infodiv.html('&lt;p class=&quot;wdpajax-error&quot; &gt;Error in processing your form.&lt;/p&gt;');
					commentform.find('textarea[name=comment]').val('');
				}
			});
		}
	});
});
</pre>
<p><strong>Code Explanation:</strong> Firstly, we append a div to comment form that will show AJAX status messages. Then we intialize jQuery Validation on comment form and if validation is successful, we will use jQuery AJAX to send the form data to the action URL of comment form and display a message accordingly.</p>
<p>Now, uptill here, if you have followed along and worked as told, you&#8217;ll find that AJAX comment posting works but validation doesn&#8217;t. Since, we are using jQuery Validation plugin, you will have to now edit the theme&#8217;s comments.php file.</p>
<h3>Enable Comment Form Validation</h3>
<p>Open your theme&#8217;s comments.php and add some CSS classes to comment form input fields as described:</p>
<ul>
<li>To comment author name input, add <code>class=&quot;required&quot;</code></li>
<li>To comment author email input, add <code>class=&quot;required email&quot;</code></li>
<li>To comment author URL input, add <code>class=&quot;url&quot;</code></li>
<li>To the comment textarea, add <code>class=&quot;required&quot;</code></li>
</ul>
<p><img src="http://webdeveloperplus.com/wp-content/uploads/2009/08/ajax-comments-wordpress.png" alt="Modify comments.php file" title="Modify comments.php file" width="635" height="202" class="largepostimage" /></p>
<p>Now the comment form validation should work. But it might be having awkward looks or styles, now the last step is to customize the looks of messages using CSS.</p>
<h3>Customize the Styles of Messaages</h3>
<p>The error messages from validation use labels with CSS class <em>error</em>. While the AJAX post request status messages use two CSS classes, wdpajax-success for AJAX success and wdpajax-error for error message. Define the styles for these classes in your theme&#8217;s stylesheet file. Here&#8217;s what i have used:</p>
<pre name="code" class="css" >
.wdpajax-error{
	border:1px solid #f9d9c9;
	padding:5px;
	color:#ff3311;
}
.wdpajax-success{
	border:1px solid #339933;
	padding:5px;
	color:#339933;
}
label.error{
	float:none !important;
	padding-left:5px;
	color:#ff3311;
}
</pre>
<p>There you are with cool AJAX comments on your WordPress Blog.<br />
<img src="http://webdeveloperplus.com/wp-content/uploads/2009/08/wdp-ajax-comments-wordpress.png" alt="AJAx WordPress Comments" title="AJAx WordPress Comments" width="520" height="379" class="largepostimage" /></p>
<p><a href="http://demo.webdeveloperplus.com/wordpress/" target="_blank" ><strong>Click here to view the Live demo</strong></a>(Try commenting on one of the posts).</p>
<p>To download the required files, <a href="http://demo.webdeveloperplus.com/source-code/wdp-ajaxcomments-theme-files.zip" target="_blank" ><strong>Click here</strong></a><br />
If you find any problems or error, do let me know in comments.</p>
<h3>Plugin</h3>
<p>If you find modifying theme file difficult, or if you regularly change your blog&#8217;s theme then it will be difficult for you to modify theme files every-time you apply a new theme. so, i have created a plugin named <a href="http://webdeveloperplus.com/wordpress/new-wordpress-plugin-wdp-ajax-comments/"><strong>WDP AJAX Comments</strong></a> that will automatically add AJAX commenting to your blog.<br />
So, do subscribe to our <a href="http://feeds2.feedburner.com/WebDeveloperPlus" title="Subscribe via RSS" >RSS Feed</a> or <a href="http://feedburner.google.com/fb/a/mailverify?uri=WebDeveloperPlus&#038;loc=en_US" target="_blank" >email updates</a> so that you are among the first one to get the plugin.<br />
Enjoy!</p>


<p>Related posts:<ol><li><a href='http://webdeveloperplus.com/wordpress/new-wordpress-plugin-wdp-ajax-comments/' rel='bookmark' title='Permanent Link: New WordPress Plugin: WDP AJAX Comments'>New WordPress Plugin: WDP AJAX Comments</a></li>
<li><a href='http://webdeveloperplus.com/design/10-ways-to-make-your-blogs-comment-form-stand-out/' rel='bookmark' title='Permanent Link: 10 Ways To Make Your Blog&#8217;s Comment Form Stand Out'>10 Ways To Make Your Blog&#8217;s Comment Form Stand Out</a></li>
<li><a href='http://webdeveloperplus.com/wordpress/12-lesser-known-but-useful-wordpress-hacks/' rel='bookmark' title='Permanent Link: 12 Lesser Known But Useful WordPress Hacks'>12 Lesser Known But Useful WordPress Hacks</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://webdeveloperplus.com/wordpress/how-to-ajaxify-wordpress-comment-posting/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>
