Skip to content

Instantly share code, notes, and snippets.

@keltanas
Last active December 11, 2015 01:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keltanas/4523876 to your computer and use it in GitHub Desktop.
Save keltanas/4523876 to your computer and use it in GitHub Desktop.
// Шаг 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);
@ron813c
Copy link

ron813c commented Jan 13, 2013

Im still hungry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment