Launch Kyle Fox Modal on Page Load after 2 seconds

Hi there,
Anyone use Kyle Fox modal plugin for jQuery?

I already use this extensively on a site and it is great but for the first time I need to launch one of the modals about 2 seconds after the page loads. All the documentation is click event based. Any ideas how I could achieve this?



You can manually open a modal by calling the .modal() method on an element. Combine this with setTimeout() and you can achieve what you desire : )

<!DOCTYPE html>
<html lang="en">
  <meta charset="utf-8" />
    <title>Kylefox modal</title>
    <link rel="stylesheet" href="jquery.modal.css" type="text/css" media="screen" />
    <div id="myDiv" class="modal">
      <h1>Some awesome content!</h1>

    <script src=""></script>
    <script src="jquery.modal.min.js" type="text/javascript" charset="utf-8"></script>
      }, 2000);
1 Like

Thanks! That did it. Really appreciate the details!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.