How can I use yepnope.js with $(document).ready() effectively?

后端 未结 5 1747
刺人心
刺人心 2020-12-23 23:01

I have been implementing the yepnope script loader as part of the modernizr.js library. I have successfully got jQuery to load and jQuery dependent scripts afterwards. I am

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-23 23:35

    script tags are loading synchronously - so if you put your yepnope in a js file and load it via script tag:

       
    
    

    right before the closing body tag you can be quite sure to be at $(document).ready() state.

    What you need to answer for yourself is whether it makes sense to force yepnope to load in a $(document).ready() fashion, as its main purpose is to break the synchronous loading order of script tags in the first place.

提交回复
热议问题