admin管理员组

文章数量:1334278

I'm using the Reveal modal plugin by Zurb.

Does anybody know how I can get the modal to execute (as in open the popup box) when my page has finished loading as opposed to when the handler is clicked?

I'd like to use it to display a simple message each time somebody opens my homepage.

I've dug through the code and tried a few things, but I'm a self confessed jQuery noob.

I was going to post the entire contents of the jQuery plugin itself, but it might just be easier to download it and take a look for yourself.

Thanks!

:)

I'm using the Reveal modal plugin by Zurb.

http://www.zurb./playground/reveal-modal-plugin

Does anybody know how I can get the modal to execute (as in open the popup box) when my page has finished loading as opposed to when the handler is clicked?

I'd like to use it to display a simple message each time somebody opens my homepage.

I've dug through the code and tried a few things, but I'm a self confessed jQuery noob.

I was going to post the entire contents of the jQuery plugin itself, but it might just be easier to download it and take a look for yourself.

Thanks!

:)

Share Improve this question asked Apr 23, 2012 at 19:47 LeelooLeeloo 1111 gold badge4 silver badges12 bronze badges 1
  • Did you try putting it in $(document).ready(...)? – jlaceda Commented Apr 23, 2012 at 19:50
Add a ment  | 

4 Answers 4

Reset to default 3
$(function() {
    $('#myModal').reveal();
});

OR

$(document).ready(function() {
    $('#myModal').reveal();
});

Couldn't you just do the following after you instantiate your modal:

$(document).ready(function() {
    // instantiate modal first
    $('#myModal').reveal();
});

Something like this should work:

<script type="text/javascript">
$(document).ready(function() {
  $('#myModal').reveal();
});
</script>

Hey had trouble getting this to work on a page using other .js libraries where JQuery NoConflict was being used -- in that case try this:

jQuery(document).ready(function($) { $('#myModal').reveal(); });

本文标签: javascriptExecute jQuery Popup When Page LoadsStack Overflow