I have found a JavaScript gallery.
When I view the JavaScript code, I really don’t understand how to write code in this style. What is the style called? Where can I find documents related to it?
Note: what i want to know is the way that define Class in this code
(function (){ … })(window)
what is style ?
jQuery.com
Based on your question, it seems you’re not familiar with jQuery. jQuery is a JavaScript framework written in JavaScript. It is most useful for it’s selector/filter capabilities, being able to pull objects of objects using something like
$('div');(orjQuery('div');), which would pull all thedivs from the page. Using dot notation, you can perform methods on those returned objects.(function (){ ... })(window)…is both an unnamed function definition and call, passing in the
windowobject. It’s sort of likefunction foo (){...} foo(window), only you don’t store the definition in variablefooand you need to wrap the definition in parentheses for syntax recognition in order to call it with the trailing parentheses.For more advanced JavaScript topics, google
closures.