Sunday 15 August 2010

javascript - What's going on with jQuery extend function? -


I'm adding a photo gallery to my website and I have to do all this work, but I'm curious what's going on In some JS,

  (function ($) {$ .fn.extend ({simpleGal: function (option) {var defaults = {main image: ".holdholder"}; options = $ .extend (defaults, options); return.Each (function () {var thumbnail = $ (this). Find ("a"), main image = $ (this) .siblings (). Find (options.mainImage); Thumbnail.one ("click", function (e) {e.preventDefault (); var gallery image = $ (this) .attr ("href"); main image .rrr ("src", gal Mr. Image);});});}});}) (JQuery);  

What is happening with $ .fn.extend? And missed? I get everything after the var thumbnail, but I'm a bit confused about what's happening in the first half.

$ .fn.extend merges two objects into one first

< / P>

Here the defualt option module will be extended with the custom options provided by the user


No comments:

Post a Comment