未捕获的ReferenceError:未定义iphoneGallery

时间:2013-03-20 18:20:24

标签: javascript jquery css jquery-ui javascript-events

我使用两种不同的j,因为我使用两种不同的布局,一种用于台式机和iphone .... 因为对于iPhone我需要减少立方体大小.... 立方体大小来自js .... 但我得到两个不同的错误......

http://jsfiddle.net/YZYp5/24/

有两个不同的js函数,一个是

$(document).ready(iphoneGallery.init);
$(document).ready(Gallery.init);

未捕获的ReferenceError:未定义iphoneGallery

$(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
            });

        });


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

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

        });

1 个答案:

答案 0 :(得分:1)

始终同时调用

$(document).ready(iphoneGallery.init);
$(document).ready(Gallery.init);

你总是尝试初始化iphoneGallery,即使对于非移动浏览器也是如此。你必须初始化其中一个,可能取决于屏幕宽度。

此外,您的iphoneGallery定义位于事件监听器中,这没有任何意义。

编辑:

我试图修复它,看看这个:http://jsfiddle.net/YZYp5/25/