Multiple jQuery plugins in one file

Is it possible to have several jquery plugins in one file (function ($)

If possible, I have a really strange problem. In my one file there are two plugins that are in the following structure:

jQuery(document).ready(function() {

(function( $ ){

// PLUGINS HERE

})( jQuery );

});

Both use the standard variable declaration template $ this as a varablie inside. An iteration that returns the main function of each plugin.

However, what happens is that the last declared plugin accepts the $ this variable from the first scarecrow, even though $ this variable is declared inside the .each function. I thought javascript has a scop level function, so this should be possible.

EDIT:

Decided it. This was a problem when anyone else has the same problem in the future:

jQuery

+3
1

, , . , , ?

+1

Source: https://habr.com/ru/post/1794982/


All Articles