I am using this code:
$('div.x').find('#y').live('click', function(e) {
var aa = $(this);
if (aa.find('a').length == 0) {
aa.find('div.z').hide();
aa.find('input:submit').click(function(e) {
//...................
});
aa.append('xxx');
$('html, body').animate({ scrollTop: 100 });
}
e.preventDefault();
});
$('body').click(function(e) {
$('div.tt').slideUp('slow');
});
$('div.uu').delegate('div.gg', 'click', function(e) {
e.stopPropagation();
});
Now I want the above piece of code into jQuery plugin. Can you tell me how can I make it? how to accept defaults from outside so that the div classes can be taken from outside instead of keeping that hardcoded in plugin?
You can use this and you just change a few things:
https://github.com/OscarGodson/jQuery-Plugin-Skeleton
This is untested, but i believe it should work:
Youd use it like this: