jquery - modernizr script sequence and IE9 -


I am loading jquery and modernizr in the head of my document like this:

  & Lt; Script src = "http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" & gt; & Lt; / Script & gt; & Lt; Script src = "js / modernizr-columntest.js" & gt; & Lt; / Script & gt; In the "columntest.js" there are some custom modernized codes that are directly from their generators, there is a small Yuppnop call that pastes it in the end that it is conditionally a plug These loads:  
  Modernizr.load ({test: Modernizr.csscolumns, no: 'js / jquery.masonry.js'});   

But the plug-in is not running properly in IE9. After a lot of headraising, I saw in the IE 9 Dev Tool that a script tag is being dynamically added with a conditionally loaded script which I can add to a modern element. If the modern script is in the head, then the generated script tag head in the IE Dev tool if I call it modern in the body, the script generated in the body is visible.

But the problem is that before the plugin script before jquery script And plug-ins require jquery to work, although I'm writing the modernizr script tag after the jquery script tag in the markup, the fallback script "noop" is being injected in the first page of the jackry script. Huh?

I'm still adjusting the work of async, can someone tell me how to fight it? (I need to call Jacqui anyway for other elements on the page anyway, so I can not load jquery conditional on any modernized test.)

UPDATE

OK, so now I (all trying to do) asychronously call everything Script tags in the head are declared as follows:

  & lt; Script src = "js / modernizr-columntest.js" & gt; & Lt; / Script & gt; & Lt; Script src = "js / envision-scriptloader.js" & gt; & Lt; / Script & gt;   

The script file contains the following:

  Moderator.load (['http://ajax.googleapis.com/ajax/libs/jquery/ 1.7 .2 / jquery.min.js', {Test: ModernGrCCccl, Nop: 'jquery.masonry.min-pluscall.js'}, {load: ["js / jquery-snelscool.js", "js / jacquery. Colorbox-min.js "], complete: function () {$ .colorbox.settings.fixed = true; // unknown settings etc $ (document) .ready (function () {$ ('thumbnail'). Colorbox ( {Internalview: 800,});})}}}]);   

But the thing to be amazed is that the Masonry plugin will not fire only. In the IE 9 Dev Devices, the script of HTML Inspector still appears in reverse order regarding jquery. Even more oddly, the masonry script appears twice in the generated code, once before jquery and once after. (!) It looks like this in the head:

  & lt; Script src = "js / jquery.masonry.min-pluscall.js" & gt; & Lt; / Script & gt; & Lt; Script src = "js / jquery-smoothscroll.js" & gt; & Lt; / Script & gt; & Lt; Script src = "js / jquery.colorbox-min.js" & gt; & Lt; / Script & gt; & Lt; Script src = "http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" & gt; & Lt; / Script & gt; & Lt; Script src = "jquery.masonry.min-pluscall.js" & gt; & Lt; / Script & gt; & Lt; Script src = "js / modernizr-columntest.js" & gt; & Lt; / Script & gt; & Lt; Script src = "js / envision-scriptloader2.js" & gt; & Lt; / Script & gt;   

Help?

Well, you've hit it on the issue. The problem is that jQuery is being synchronously loaded, while your plugin is being loaded asynchronously, in IE, it is likely that the plug-in loads first, but in reality, it is It can also be in the browser at any time. Its solution is to load jQuery asynchronous, and then load your plugin into full branch:

  Modernizr.load ({load: 'http: // ajax .googleapis.com / ajax / libs / jquery / 1.7.2 / jquery.min.js ', complete: function () {Modernizr.load ({test: Modernizr.csscolumns, not:' js / jquery. Masonry.js'});}); }); In fact, technically, all you have to do is keep them in sequence.   

edit

This will also work:

  Modernizr.load (['http: / /ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js', {Test: ModerniZrak.css Columns, Nop: 'js / jquery.masonry.js'}])));    

Comments