SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard
    Join Date
    Aug 2002
    Location
    N.Ireland
    Posts
    1,046
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Jquery dialog box delay event

    I'm using the basic source from http://jqueryui.com/demos/dialog/ to initiate a dialog box as a page loads. However, I'd like to delay it by 5 seconds, can anyone help?
    Code:
        <script type="text/javascript">
        $.ui.dialog.defaults.bgiframe = true;
        $(function() {
            $("#dialog").dialog();
        });
        </script>

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by Daz View Post
    I'm using the basic source from http://jqueryui.com/demos/dialog/ to initiate a dialog box as a page loads. However, I'd like to delay it by 5 seconds, can anyone help?
    The html script tags have been stripped out of this sample code, as they are only appropriate for when using inline javascript.

    Code javascript:
    $.ui.dialog.defaults.bgiframe = true;
    $(function() {
        window.setTimout(function () {
            $("#dialog").dialog();
        }, 5000);
    });
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Wizard
    Join Date
    Aug 2002
    Location
    N.Ireland
    Posts
    1,046
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks that worked a treat. Just for future ref there was a minor typo ie window.setTimeout

  4. #4
    SitePoint Wizard
    Join Date
    Aug 2002
    Location
    N.Ireland
    Posts
    1,046
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually just discovered there's a glich with this in that the dialog text is rendered on screen until the 5 seconds expire then it's removed and inserted into the dialog box which appears. Adding display: none to the dialog div fixed it.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •