The answer to How to generate a simple popup using jQuery presents the following short jsFiddle http://jsfiddle.net/SRw67/. In the jsFiddle you find:
function deselect(e) {
$('.pop').slideFadeToggle(function() {
e.removeClass('selected');
});
}
where the function slideFadeToggle is defined as:
$.fn.slideFadeToggle = function(easing, callback) {
return this.animate({ opacity: 'toggle', height: 'toggle' }, 'fast', easing, callback);
};
In the jQuery documentation I found:
easing A string indicating which easing function to use for the transition.
The function slideFadeToggle has 2 parameters but in the code only a function is passed. Does jQuery automatically identify that the parameter is a function and thus skips the easing parameter and passes the function as the callback? Or why is this working, when obviously the easing parameter is missing?
Further, why is the author using $.fn.slideFadeToggle =..?
I found here What does jQuery.fn mean? that this is a shortcut for $.prototype.slideFadeToggle but it does not make any sense to me. Why is this useful here?