2011-10-28 49 views

回答

2

這不包括窗口大小調整,但也許它會讓你在正確的方向。

$(document).ready(function() { 
    var viewportWidth = $(window).width(); 
    var viewportHeight = $(window).height(); 

    var widthThreshold = 1000; 
    var heightThreshold = 800; 

    var scriptUrl; 
    if (viewportWidth > widthThreshold && 
     viewportHeight > heightThreshold){ 
     scriptUrl = "plugin1.js"; 
    } 
    else { 
     scriptUrl = "plugin2.js"; 
    } 
    $.getScript(scriptUrl); 
};