2013-04-02 45 views
1

一旦加載了所有文件,是否可以觸發全局完成回調?例如:yepnope/modernizr.load全局完成回調?

yepnope(['file1.js', 'file2.js']) 

....一些HTML ....

<script> 
    yepnope({complete: function() { console.log('This is getting called before the above files finish loading') }); 
</script> 

回答

1

您是否嘗試過類似於下面的東西?

Modernizr.load([ 

    { 
    load : ["file1.js", "file2.js"], 
    complete : function() 
    { 
    // do some stuff 
    } 
    } // can repeat this block as required 

]); 

祝你好運!