0

我正在尝试在页面加载时调用 jquery (avgrund) 模态窗口插件,但我不知道该怎么做,这是我目前所拥有的;插件页面在按钮单击时调用插件,但我不希望它在页面加载时执行...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" class="no-js">
<head>
    <title></title> 
    <link rel="stylesheet" type="text/css" href="AvgrundModal/avgrund.css" /> 
</head>
<body>
    <div id="avtest">NO RESULTS</div>

    <!-- Include JavaScript file -->
    <script src="AvgrundModal/jquery.avgrund.js"></script>
    <script>
        $(document).ready(function(){
        $('#avtest').avgrund();
        });
    </script>
</body>
</html>

该插件的链接在这里... http://labs.voronianski.com/jquery.avgrund.js/

4

5 回答 5

2

改变这个:

$('#avtest').avgrund();

为了这:

 $('#avtest').avgrund().trigger("click");
于 2014-03-07T02:03:49.120 回答
1

初始化后触发click事件即可。

    $(document).ready(function(){
        $('#avtest').avgrund().click();
    });
于 2014-03-07T02:03:30.480 回答
1

您在这里缺少 jQuery 库:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="AvgrundModal/jquery.avgrund.js"></script>  
<script>
    $(document).ready(function(){
         $('#avtest').avgrund();
    });
</script>

并尝试改变:

$('#avtest').avgrund();

到:

$('#avtest').avgrund().click();
于 2014-03-07T02:03:38.897 回答
1
$(function() {
    $('#avtest').avgrund({
        height: 200,
        holderClass: 'custom',
        showClose: true,
        showCloseText: 'Close',
        enableStackAnimation: true,
        onBlurContainer: '.container',
        template: '<p>So implement your design and place content here! If you want to close modal, please hit "Esc", click somewhere on the screen or use special button.</p>' +
        '<div>' +
        '<a href="http://github.com/voronianski/jquery.avgrund.js" target="_blank" class="github">Avgrund on Github</a>' +
        '<a href="http://twitter.com/voronianski" target="_blank" class="twitter">Twitter</a>' +
        '<a href="http://dribbble.com/voronianski" target="_blank" class="dribble">Dribbble</a>' +
        '</div>'
    });
            $('#avtest').click();
});
于 2014-03-07T02:03:44.353 回答
0

openOnEvent 选项对我有用。

$(document).avgrund({
    openOnEvent: false
});
于 2017-02-09T21:09:39.193 回答