当打开页面而不是单击时,Jquery显示模态触发

时间:2014-11-14 01:10:11

标签: jquery html modal-dialog

我正在使用jquery揭示模态插件,它工作正常,但是当我打开页面时,我突然开始触发所有三个模态,URL为mike-griffin.com/index.html,脚本为i&#m; m用于此特定模态如下:

<script src="js/jquery-1.4.4.min.js"></script>
<script src="js/jquery.vegas.js"></script>
<script>
    //code that uses 1.4.4 should be enclosed as follows
    jQuery(function( $ ) {

        $.vegas('slideshow', {
        backgrounds:[
        { src:'img/Background img/Zoe-10-Background.jpg', fade:1000 },
        { src:'img/Background img/Background2.jpg', fade:1000 },
        { src:'/img/background3.jpg', fade:1000 }
        ]
        })('overlay');


 ;$('#main-nav-modal').reveal({
 animation: 'fadeAndPop',                   //fade, fadeAndPop, none
 animationspeed: 300,                       //how fast animtions are
 closeonbackgroundclick: true,              //if you click background will modal close?
 dismissmodalclass: 'close-reveal-modal'    //the class of a button or element that will close an open modal
});

;$('#sale-nav-modal').reveal({
 animation: 'fadeAndPop',                   //fade, fadeAndPop, none
 animationspeed: 300,                       //how fast animtions are
 closeonbackgroundclick: true,              //if you click background will modal close?
 dismissmodalclass: 'close-reveal-modal'    //the class of a button or element that will close an open modal
});

;$('#about-modal').reveal({
 animation: 'fadeAndPop',                   //fade, fadeAndPop, none
 animationspeed: 300,                       //how fast animtions are
 closeonbackgroundclick: true,              //if you click background will modal close?
 dismissmodalclass: 'close-reveal-modal'    //the class of a button or element that will close an open modal
});
    });
</script>

我不太确定为什么会发生这种情况,希望这很容易解决,不管怎样,谢谢!

1 个答案:

答案 0 :(得分:0)

好的,因为没有更多的输入,我会发布答案,因为我使用它的工作,可能会帮助有同样问题的人。

我只是在模态脚本之前添加了以下脚本。

(jquery);

最终脚本如下所示......

<script src="js/jquery-1.4.4.min.js"></script>
<script src="js/jquery.vegas.js"></script>
<script>
    //code that uses 1.4.4 should be enclosed as follows
    jQuery(function( $ ) {

        $.vegas('slideshow', {
        backgrounds:[
        { src:'img/Background img/Zoe-10-Background.jpg', fade:1000 },
        { src:'img/Background img/Background2.jpg', fade:1000 },
        { src:'img/Background img/Background3.jpg', fade:1000 },
        { src:'img/Background img/Background4.jpg', fade:1000 },
        { src:'img/Background img/Background5.jpg', fade:1000 },
        ]
        })('overlay');

    (jquery);

 $('#main-nav-modal').reveal({
 animation: 'fadeAndPop',                   //fade, fadeAndPop, none
 animationspeed: 300,                       //how fast animtions are
 closeonbackgroundclick: true,              //if you click background will modal close?
 dismissmodalclass: 'close-reveal-modal'    //the class of a button or element that will close an open modal
});

;$('#sale-nav-modal').reveal({
 animation: 'fadeAndPop',                   //fade, fadeAndPop, none
 animationspeed: 300,                       //how fast animtions are
 closeonbackgroundclick: true,              //if you click background will modal close?
 dismissmodalclass: 'close-reveal-modal'    //the class of a button or element that will close an open modal
});

;$('#about-modal').reveal({
 animation: 'fadeAndPop',                   //fade, fadeAndPop, none
 animationspeed: 300,                       //how fast animtions are
 closeonbackgroundclick: true,              //if you click background will modal close?
 dismissmodalclass: 'close-reveal-modal'    //the class of a button or element that will close an open modal
});
    });
</script>