jQuerty functions.js what is this for ?
Hi, here is the code I have in that file. I started reading the tutorial just in the beginning and there was explaining where I need to write my functions after the ready event. Ok but with with HTML5 Reset I have this index.html page setup with jQuery:
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script>!window.jQuery && document.write(unescape(''))</script>
<script src="js/functions.js"></script>
And I was wondering why do I have this functions.js file. Looks like it's some kind of a start up file in which I should start writing my jQuery code and one of the comments suggest that is the same as the ready event. But I don't get any of this. Why do I need a namespace. I see it declared but not used. The next line starts with (function($) { ... really ? with "(" ? I am kinda new to javascript, did a lot of flash, but I really don't get this.
Could someone explain me what are these lines below for please? And maybe any guide where can I look up this syntax so I begin to understand what is going on... Thanks a lot in advance !!! :)
- /* Declare a namespace for the site */
var Site = window.Site || {};
- /* Create a closure to maintain scope of the '$'
and remain compatible with other frameworks. */
(function($) {
//same as $(document).ready();
$(function() {
- });
$(window).bind("load", function() {
});
})(jQuery);