2013-10-18 28 views
0

網站:beauforgovernor.com隱藏的fancybox觸發頁面加載在手機

我有觸發頁面加載(僅在主頁上)一個的fancybox,但我不希望它出現在手機上;不過,我仍然希望它在平板電腦上顯示。

我不知道如何編碼。

這是我目前使用的JS:

<script type="text/javascript"> 
$(document).ready(function() { 

    $("#aLink").fancybox({ 
     'width'    : '640', 
     'height'   : 'auto', 
     'autoScale'   : true, 
     'transitionIn'  : 'none', 
     'transitionOut'  : 'none', 
     'type'    : 'iframe' 
    }); 
}); 

回答

0

剎那間要選擇你認爲是移動其屏幕尺寸,可能很難像一些片劑勉強比一些更大智能手機...

$(function(){ 
    var viewport = { 
     width : $(window).width(), 
     height : $(window).height() 
    }; 
    if(viewport.width>"480" && viewport.height>"600") 
    { 
     $("#aLink").fancybox({ 
      'width'    : '640', 
      'height'   : 'auto', 
      'autoScale'   : true, 
      'transitionIn'  : 'none', 
      'transitionOut'  : 'none', 
      'type'    : 'iframe' 
     }); 
    } 
);