开发者

How do I invoke a SimpleModal OSX dialog on page load?

开发者 https://www.devze.com 2022-12-09 10:40 出处:网络
I was wondering if there is a way to invoke the SimpleModal OSX dialog box on page load? I tried open jquery modal dialog on page load but wasn\'t able to make it happen.

I was wondering if there is a way to invoke the SimpleModal OSX dialog box on page load? I tried open jquery modal dialog on page load but wasn't able to make it happen.

Currently, the dialog is invoked on clicking a button / link. I would like to invoke it on page load.

Please help. :)

Thanks!

<script type='text/javascript' src='js/jquery.js'></script>
<script type='text/javascript' src='js/jquery.simplemodal.js'></script>
<script type='text/javascript' src='js/osx.js'></script>

<input type='button' name='osx' value='Demo' class='osx demo'/> or <a href='#' class='osx'>Demo</a>

<div id="osx-modal-content"开发者_开发知识库>
  <div id="osx-modal-data">
    <h2>Hello! I'm SimpleModal!</h2>
    <p><button class="simplemodal-close">Close</button> <span>(or press ESC or click the overlay)</span></p>
  </div>
</div>


This part taken from the question you referenced should do the trick:

$(document).ready(function(){
    $("#osx-modal-content").modal();
});

The .ready() function is invoked just after the DOM has loaded. If this doesn't work but clicking on your button works I can only guess that some part of the code hasn't loaded yet that is essential for a dialog.

Try looking at the errors you get from your javascript. All modern browsers let you do that.


You should add that code into osx.js script in this part:

        $(document).ready(function() {

            $("#osx-modal-content").modal({
                overlayId: 'osx-overlay',
                containerId: 'osx-container',
0

精彩评论

暂无评论...
验证码 换一张
取 消