我试图在页面加载时调用一个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/
答案 0 :(得分:2)
改变这个:
$('#avtest').avgrund();
为此:
$('#avtest').avgrund().trigger("click");
答案 1 :(得分:1)
初始化后只需触发click
事件。
$(document).ready(function(){
$('#avtest').avgrund().click();
});
答案 2 :(得分: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();
答案 3 :(得分: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();
});
答案 4 :(得分:0)
openOnEvent选项对我有用。
$(document).avgrund({
openOnEvent: false
});