自动打开reaveal模态 [英] Automatically open reaveal modal
本文介绍了自动打开reaveal模态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在页面加载时打开Reveal Modal Popup,而不点击任何内容
I want to open Reveal Modal Popup when page loads, without clicking anything
以下是:
<!DOCTYPE html>
<head>
<title>Modal PopUp</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/reveal.css">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.min.js"></script>
<script type="text/javascript" src="js/jquery.reveal.js"></script>
<script language="JavaScript">
$(function() {
$( "#myModal" ).dialog();
});
</script>
</head>
<body>
<!-- #reveal modal popup -->
<div id="myModal" class="reveal-modal">
<h1>Reveal Modal Goodness</h1>
<p>This is a default modal in all its glory, but any of the styles here can easily be changed in the CSS.</p>
<a class="close-reveal-modal">×</a>
</div>
<!-- #reveal modal popup -->
</body>
</html>
我不想使用此触发器:
<a href="#" data-reveal-id="myModal">Click Me For A Modal</a>
它应该自动打开。
推荐答案
你可以隐藏锚标签并以编程方式点击它:
you can hide the anchor tag and click it programmatically:
<a href="#" id="clickMe" data-reveal-id="myModal" style="display:none;">Click Me For A Modal</a>
$('#clickMe').click();
它将打开而不点击页面上的任何链接或按钮,但在后面我们以编程方式单击它。
it will open without clicking any link or button on page but on behind we programmatically click it.
你也可以这样做:
$("#myModal").reveal();
这篇关于自动打开reaveal模态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文