I made this simple extension of jQuery:
(function($)
{
$.fn.extend({
animateleft: function(amount) {
$().animate({
left: amount
}, 300, function() { });
return $();
}
});
})(jQuery);
I understand that by returning $() it enables chaining. I dont know what exactly is contained in $() however. The animate function doesnt seem to get triggered when I try something like:
$('#container').animateleft("+=300");
Which I think should work if $(‘#container’) is whats passed in to the extensions as $().
Inside a plugin method, the selected elements are referenced by
this. So it should be:$()just calls the jQuery function with no parameter, which returns a new (empty) jQuery object.