<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Making a jQuery Plugin Truly Customizable</title>
	<atom:link href="http://www.learningjquery.com/2009/03/making-a-jquery-plugin-truly-customizable/feed" rel="self" type="application/rss+xml" />
	<link>http://www.learningjquery.com/2009/03/making-a-jquery-plugin-truly-customizable</link>
	<description>Tips, techniques, and tutorials for the jQuery JavaScript library</description>
	<lastBuildDate>Wed, 08 Feb 2012 13:50:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Gary Stanton</title>
		<link>http://www.learningjquery.com/2009/03/making-a-jquery-plugin-truly-customizable/comment-page-1#comment-83653</link>
		<dc:creator>Gary Stanton</dc:creator>
		<pubDate>Mon, 25 Apr 2011 14:07:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=641#comment-83653</guid>
		<description>Thanks a lot for this post... I&#039;m with Steven Black - there&#039;s hardly any good info out there on how to add callbacks to events in a plugin, and this post helped me out enormously... Cheers!</description>
		<content:encoded><![CDATA[<p>Thanks a lot for this post&#8230; I&#8217;m with Steven Black &#8211; there&#8217;s hardly any good info out there on how to add callbacks to events in a plugin, and this post helped me out enormously&#8230; Cheers!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sfsf</title>
		<link>http://www.learningjquery.com/2009/03/making-a-jquery-plugin-truly-customizable/comment-page-1#comment-83593</link>
		<dc:creator>sfsf</dc:creator>
		<pubDate>Wed, 30 Mar 2011 08:52:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=641#comment-83593</guid>
		<description>&lt;pre&gt;&lt;code&gt;
(function($){
    $.fn.extend({
        //plugin name - animatemenu
        test: function(options) {
            var defaults = {
				msg1:&#039;xxx&#039;,
				msg2:&#039;yyy&#039;,
				view:function(){ return &#039;this is me&#039;; }
            };
            var options = $.extend(defaults, options);
            return this.each(function() {
                  var o =options;
                  var obj = $(this);
				  $(this).click(function(){
				  	st=o.view();
					alert(st);
				  });                
            });//return
        }//test
    });
})(jQuery); 

////
$(document).ready(function(){
	$(&#039;#a1&#039;).test(
	);
	$(&#039;#a2&#039;).test({
		view:function(){
			return $(this).text();//this is not run, why?? help me
		}
	});
});
&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<pre><code>
(function($){
    $.fn.extend({
        //plugin name - animatemenu
        test: function(options) {
            var defaults = {
				msg1:'xxx',
				msg2:'yyy',
				view:function(){ return 'this is me'; }
            };
            var options = $.extend(defaults, options);
            return this.each(function() {
                  var o =options;
                  var obj = $(this);
				  $(this).click(function(){
				  	st=o.view();
					alert(st);
				  });
            });//return
        }//test
    });
})(jQuery); 

////
$(document).ready(function(){
	$('#a1').test(
	);
	$('#a2').test({
		view:function(){
			return $(this).text();//this is not run, why?? help me
		}
	});
});
</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mazil</title>
		<link>http://www.learningjquery.com/2009/03/making-a-jquery-plugin-truly-customizable/comment-page-1#comment-81318</link>
		<dc:creator>Mazil</dc:creator>
		<pubDate>Tue, 03 Aug 2010 00:41:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=641#comment-81318</guid>
		<description>Thanks so much for this article! I&#039;m just starting to delve into jquery plugins and it&#039;s hard to find clear, concise examples of what is good practice. Your callback code was very very useful too :)</description>
		<content:encoded><![CDATA[<p>Thanks so much for this article! I&#8217;m just starting to delve into jquery plugins and it&#8217;s hard to find clear, concise examples of what is good practice. Your callback code was very very useful too :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 20 Must Read JQuery Tutorials for Web Developers &#124; Gadgets World</title>
		<link>http://www.learningjquery.com/2009/03/making-a-jquery-plugin-truly-customizable/comment-page-1#comment-80496</link>
		<dc:creator>20 Must Read JQuery Tutorials for Web Developers &#124; Gadgets World</dc:creator>
		<pubDate>Fri, 18 Jun 2010 16:12:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=641#comment-80496</guid>
		<description>[...] M&amp;#97king &amp;#97 jQuery Plugin Truly Cus&amp;#116o&amp;#109iz&amp;#97ble [...]</description>
		<content:encoded><![CDATA[<p>[...] M&amp;#97king &amp;#97 jQuery Plugin Truly Cus&amp;#116o&amp;#109iz&amp;#97ble [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Crear un plugin con jQuery &#124; Uninstallme</title>
		<link>http://www.learningjquery.com/2009/03/making-a-jquery-plugin-truly-customizable/comment-page-1#comment-80423</link>
		<dc:creator>Crear un plugin con jQuery &#124; Uninstallme</dc:creator>
		<pubDate>Sun, 06 Jun 2010 18:18:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=641#comment-80423</guid>
		<description>[...] Making a jQuery Plugin Truly Customizable [...]</description>
		<content:encoded><![CDATA[<p>[...] Making a jQuery Plugin Truly Customizable [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 20 Must Read JQuery Tutorials for Web Developers &#124; Gadgets World</title>
		<link>http://www.learningjquery.com/2009/03/making-a-jquery-plugin-truly-customizable/comment-page-1#comment-80335</link>
		<dc:creator>20 Must Read JQuery Tutorials for Web Developers &#124; Gadgets World</dc:creator>
		<pubDate>Wed, 19 May 2010 15:13:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=641#comment-80335</guid>
		<description>[...] Making a j&amp;#81u&amp;#101ry Plugin Truly Custo&amp;#109izabl&amp;#101 [...]</description>
		<content:encoded><![CDATA[<p>[...] Making a j&amp;#81u&amp;#101ry Plugin Truly Custo&amp;#109izabl&amp;#101 [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paginate Anything with jQuery! &#124; Software Source Update</title>
		<link>http://www.learningjquery.com/2009/03/making-a-jquery-plugin-truly-customizable/comment-page-1#comment-79252</link>
		<dc:creator>Paginate Anything with jQuery! &#124; Software Source Update</dc:creator>
		<pubDate>Sun, 29 Nov 2009 01:55:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=641#comment-79252</guid>
		<description>[...] Making a jQuery Plugin Truly Customizable [...]</description>
		<content:encoded><![CDATA[<p>[...] Making a jQuery Plugin Truly Customizable [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vincent</title>
		<link>http://www.learningjquery.com/2009/03/making-a-jquery-plugin-truly-customizable/comment-page-1#comment-78671</link>
		<dc:creator>Vincent</dc:creator>
		<pubDate>Wed, 09 Sep 2009 16:35:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=641#comment-78671</guid>
		<description>Hi, really nice article,
I&#039;ve just a question regarding JSLINT. It suggests this : 

/////////
Move the invocation into the parens that contain the function.
.....
....})(jQuery);
/////////

and now we get this :

/////////
....
....}(jQuery));
/////////

do you see something dangerous with this transformation?

Thank you very much.

Vincent</description>
		<content:encoded><![CDATA[<p>Hi, really nice article,<br />
I&#8217;ve just a question regarding JSLINT. It suggests this : </p>
<p>/////////<br />
Move the invocation into the parens that contain the function.<br />
&#8230;..<br />
&#8230;.})(jQuery);<br />
/////////</p>
<p>and now we get this :</p>
<p>/////////<br />
&#8230;.<br />
&#8230;.}(jQuery));<br />
/////////</p>
<p>do you see something dangerous with this transformation?</p>
<p>Thank you very much.</p>
<p>Vincent</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mr Speaker</title>
		<link>http://www.learningjquery.com/2009/03/making-a-jquery-plugin-truly-customizable/comment-page-1#comment-78629</link>
		<dc:creator>Mr Speaker</dc:creator>
		<pubDate>Tue, 08 Sep 2009 01:57:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=641#comment-78629</guid>
		<description>Thanks for the great blog! Just one thing that I like to do with my plugins is provide an &quot;unnamed&quot; callback kind of like in the jQuery core. Then you have your plugin signature as &lt;code&gt;$.fn.superGallery = function(options, callback)&lt;/code&gt; with the callback as the second parameter. When there are no options, you check to see if &quot;options&quot; are options or really the callback (this looks like how they do it in jQuery)
&lt;code&gt;&lt;pre&gt;var defaults = { delay : 80 };
if ( jQuery.isFunction( options ) ) {
	callback = options;
	options = {};
}
var settings = $.extend({}, defaults, options);&lt;/pre&gt;&lt;/code&gt;Something like that. Then you can call the callback like before (but check if you have to):
&lt;code&gt;if ( callback ) callback.call(this);&lt;/code&gt;
Then you can use the plugin without options:
&lt;code&gt;$(&#039;ul.imgs li&#039;).superGallery( function(){ /* callback */ } );&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Thanks for the great blog! Just one thing that I like to do with my plugins is provide an &#8220;unnamed&#8221; callback kind of like in the jQuery core. Then you have your plugin signature as <code>$.fn.superGallery = function(options, callback)</code> with the callback as the second parameter. When there are no options, you check to see if &#8220;options&#8221; are options or really the callback (this looks like how they do it in jQuery)<br />
<code>
<pre>var defaults = { delay : 80 };
if ( jQuery.isFunction( options ) ) {
	callback = options;
	options = {};
}
var settings = $.extend({}, defaults, options);</pre>
<p></code>Something like that. Then you can call the callback like before (but check if you have to):<br />
<code>if ( callback ) callback.call(this);</code><br />
Then you can use the plugin without options:<br />
<code>$('ul.imgs li').superGallery( function(){ /* callback */ } );</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wheresrhys &#187; Blog Archive &#187; My jQuery plugin writing tips</title>
		<link>http://www.learningjquery.com/2009/03/making-a-jquery-plugin-truly-customizable/comment-page-1#comment-78495</link>
		<dc:creator>wheresrhys &#187; Blog Archive &#187; My jQuery plugin writing tips</dc:creator>
		<pubDate>Wed, 02 Sep 2009 18:58:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=641#comment-78495</guid>
		<description>[...] jQuery. There still is, but one thing that struck me is that there are a lot of great tutorials on writing jQuery plugins out there but none of them individually captures all the things that took my plugins [...]</description>
		<content:encoded><![CDATA[<p>[...] jQuery. There still is, but one thing that struck me is that there are a lot of great tutorials on writing jQuery plugins out there but none of them individually captures all the things that took my plugins [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced (User agent is rejected)
Database Caching 6/18 queries in 0.005 seconds using disk: basic
Object Caching 371/372 objects using disk: basic
Content Delivery Network via learningjquery.kswedberg.netdna-cdn.com

Served from: www.learningjquery.com @ 2012-02-08 17:44:56 -->
