Last active
December 11, 2015 01:29
-
-
Save keltanas/4523876 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Шаг 1 | |
function(){} // объявляем анонимную функцию | |
// Шаг 2 | |
(function(){})(); // - объявляем и запускаем анонимную функцию | |
// Шаг 3 | |
(function($){ | |
// ... | |
})(jQuery); // - Запускаем анонимную функцию с параметром jQuery. Функция принимает его, как $ | |
// аналогично как: | |
function run( $ ) { | |
// ... | |
} | |
run(jQuery); | |
// только не засоряем пространство имен | |
// Шаг 4 | |
jQuery.noConflict(); | |
(function($){ | |
$(function(){ // тоже, что и $(document).ready( func ) и $(document).on('ready', func) | |
// do some code, when dom is ready | |
}); | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Im still hungry