经过大量研究和挫折后,我想我在移动设备上禁用fancybox的方法可能出错了
<script type="text/javascript">
$(document).ready(function()
{
if( $(window).width() > 480 && (!navigator.userAgent.match(/Android/i) ||
!navigator.userAgent.match(/webOS/i) ||
!navigator.userAgent.match(/iPhone/i) ||
!navigator.userAgent.match(/iPod/i) ||
navigator.userAgent.match(/BlackBerry/))
){
$("a#for_fancybox").fancybox({
'overlayShow' : false,
'transitionIn' : 'elastic',
'transitionOut' : 'elastic'
}
else( $("a#for_fancybox").fancybox({ "scrolling": "yes", "centerOnScroll": "yes", "showCloseButton": true, "height": "95%", "width": "95%", "type": "iframe", "autoScale": true, "cyclic": true, "overlayOpacity": 0.8, "showNavArrows": false, "titleShow": false, "content": "<div> n"}
</script>
我相信这很简单,并且会感谢任何人提供的任何建议。
*我一直在玩,并且正在取得进展,但是脚本仍在手机上运行。我想知道我是否正确执行了 detectmobilebrowser.js 执行(转换为 .js 文件并在站点的头文件中放置脚本标记)。
`<script type="text/javascript">
if( !jQuery.browser.mobile){
$(document).ready(function() {
$("#single1").fancybox({
"scrolling": "yes", "centerOnScroll": "yes", "showCloseButton": true, "height": "95%", "width": "95%", "type": "iframe", "autoScale": true, "cyclic": true, "overlayOpacity": 0.8, "showNavArrows": false, "titleShow": false, "content": "<div> n"
});
$("#single2").fancybox({
"scrolling": "yes", "centerOnScroll": "yes", "showCloseButton": true, "height": "95%", "width": "95%", "type": "iframe", "autoScale": true, "cyclic": true, "overlayOpacity": 0.8, "showNavArrows": false, "titleShow": false, "content": "<div> n"
});
});
}
</script>`