2

我添加了重新调整大小功能,因为当我使用媒体查询时,立方体没有显示出来....当我将浏览器调整到 iPhone 屏幕的大小时,iPhone 图像只有在刷新页面时才会出现....但是每次我调整窗口大小时,它都会不断刷新.....是否有可能只为 iPhone 屏幕刷新浏览器窗口......就像在 js 中指定宽度......

在下面提供我的代码....

http://jsfiddle.net/sDXTx/1/

<script type="text/javascript">



$(window).bind('resize', function() { location.reload();

     Gallery.setOptions({
            size: 78,
            lightbox: false,
            //animation:  'drop'
            //speed:      500,
            //closeOnEsc: true,
            //slideshow:  false,
            //slideshow_speed: 3000,
            //cube_speed: 1000
        });

 })
4

1 回答 1

2

这应该可以解决问题:

if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
    $(window).bind('resize', function () {
        location.reload();
        Gallery.setOptions({
            size: 78,
            lightbox: false
            //animation:  'drop'
            //speed:      500,
            //closeOnEsc: true,
            //slideshow:  false,
            //slideshow_speed: 3000,
            //cube_speed: 1000
        });

    })
}

另外,请务必删除参数中的最后一个逗号,否则 IE 会抛出错误!

于 2013-02-08T19:40:22.437 回答