How to bring up SimpleModal OSX dialog on page load?

I was wondering if there is a way to bring up the SimpleModal OSX dialog on page load? I tried to open a jquery modal dialog on page load but was unable to do so.

Currently, the dialog is called when a button / link is clicked. I would like to call it on page load.

Please, help.:)

Thank!

<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>

      

-1


source to share


2 answers


This part, taken from the question you linked to, should do the trick:

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

      



The function .ready()

is called immediately after the DOM has loaded. If that doesn't work, but clicking on the button works, I can only guess that some of the code hasn't been loaded yet, which is what the dialog needs to do.

Try looking at the errors you are getting from your javascript. All modern browsers allow you to do this.

0


source


You should add this code to your osx.js script in this part:



        $(document).ready(function() {

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

      

0


source







All Articles