javascript - 自动打开显示模式

标签 javascript jquery html reveal.js

我想在页面加载时打开“显示模式弹出窗口”,而不单击任何内容

这里有:

<!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">&#215;</a>
        </div>

    <!-- #reveal modal popup -->           
</body>
</html>

我不想使用此触发器:

<a href="#" data-reveal-id="myModal">Click Me For A Modal</a>

它应该会自动打开。

最佳答案

试试这个

$(document).ready(function() {  //or  $(window).load(function(){ 
    $('#myModal').reveal($(this).data());
});

关于javascript - 自动打开显示模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22860470/

相关文章:

javascript - 解析云代码部署失败,消息为 "Update failed with internal error"

javascript - Tailwind CSS 不适用于 React App

javascript - 动画模式无法正常工作

javascript - 检查不同类的两个不同元素

javascript - php脚本邮件程序模式 Bootstrap

javascript - 从服务返回订阅 - 但如何在服务中使用异步结果?

c# - 将字符串数组从 ajax 传递到 C# Web 方法

html - 使用外部 CSS 样式表设置 SVG 行的样式

HTML/CSS 未知元素拉伸(stretch)页面

python - Scrapy:无法在 HTML 文档中使用 Xpath、response.css 选择内容