scaron / prettyphoto

prettyPhoto is a jQuery based lightbox clone. Not only does it support images, it also add support for videos, flash, YouTube, iFrames. It’s a full blown media lightbox. The setup is easy and quick, plus the script is compatible in every major browser.
http://www.no-margin-for-errors.com/projects/prettyPhoto-jquery-lightbox-clone/
553 stars 280 forks source link

Use only one jQuery variable inside pretty photo gallery #118

Open ferrante opened 11 years ago

ferrante commented 11 years ago

A few jQuery functions like .map or .inArray are used this way:

jQuery.inArray(/**/)

As in Pretty Photo plugin a jQuery variable is passed using an anonymous function:

(function($) {
    // plugin code
})(jQuery);

A safer option is to use $ variable all along the way inside a plugin code. It's very important when you deal with a few versions of jQuery at the same time on the single web page since it can take a jQuery version without .map function or something like that. The other reason is a consistency.