title: creating a popup window with jquery just after the page finish the loading without any button to be pressed
body: <p>i created a popup window using html and javascript and jquery with button click where the user must press on the link to show the popup window </p>
  
  <p>what i need  is to make the window popup without clicking on any link or button just after the page finish the loading </p>
  
  <p>can anyone help me with this ???</p>
  
  <p>this is the code for the popup window</p>
  
  <h1>index.html</h1>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;title&gt;Creating Popup window&lt;/title&gt;
  &lt;link href="style/style.css" rel="stylesheet" type="text/css" media="all" /&gt;
  &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"&gt; &lt;/script&gt;
  &lt;script type="text/javascript" src="js/script.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;a href="#" class="topopup"&gt;Click Here Trigger&lt;/a&gt;
  
      &lt;div id="toPopup"&gt; 
  
          &lt;div class="close"&gt;&lt;/div&gt;
          &lt;span class="ecs_tooltip"&gt;Press Esc to close &lt;span class="arrow"&gt;&lt;/span&gt;&lt;/span&gt;
          &lt;div id="popup_content"&gt; &lt;!--your content start--&gt;
              &lt;p&gt;
              TEST FOR THE POPUP WINDOW. &lt;/p&gt;
              &lt;br /&gt;
              &lt;p align="center"&gt;&lt;a href="#" class="livebox"&gt;Click Here Trigger&lt;/a&gt;&lt;/p&gt;
          &lt;/div&gt; &lt;!--your content end--&gt;
  
      &lt;/div&gt; &lt;!--toPopup end--&gt;
  
      &lt;div class="loader"&gt;&lt;/div&gt;
      &lt;div id="backgroundPopup"&gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <h1>script.js</h1>
  
  <pre><code>jQuery(function($) {
  
      $("a.topopup").click(function() {
              loading(); // loading
              setTimeout(function(){ // then show popup, deley in .5 second
                  loadPopup(); // function show popup 
              }, 500); // .5 second
      return false;
      });
  
      /* event for close the popup */
      $("div.close").hover(
                      function() {
                          $('span.ecs_tooltip').show();
                      },
                      function () {
                          $('span.ecs_tooltip').hide();
                      }
                  );
  
      $("div.close").click(function() {
          disablePopup();  // function close pop up
      });
  
      $(this).keyup(function(event) {
          if (event.which == 27) { // 27 is 'Ecs' in the keyboard
              disablePopup();  // function close pop up
          }   
      });
  
      $("div#backgroundPopup").click(function() {
          disablePopup();  // function close pop up
      });
  
      $('a.livebox').click(function() {
          alert('Hello World!');
      return false;
      });
  
  
       /************** start: functions. **************/
      function loading() {
          $("div.loader").show();  
      }
      function closeloading() {
          $("div.loader").fadeOut('normal');  
      }
  
      var popupStatus = 0; // set value
  
      function loadPopup() { 
          if(popupStatus == 0) { // if value is 0, show popup
              closeloading(); // fadeout loading
              $("#toPopup").fadeIn(0500); // fadein popup div
              $("#backgroundPopup").css("opacity", "0.7"); // css opacity, supports IE7, IE8
              $("#backgroundPopup").fadeIn(0001); 
              popupStatus = 1; // and set value to 1
          }   
      }
  
      function disablePopup() {
          if(popupStatus == 1) { // if value is 1, close popup
              $("#toPopup").fadeOut("normal");  
              $("#backgroundPopup").fadeOut("normal");  
              popupStatus = 0;  // and set value to 0
          }
      }
      /************** end: functions. **************/
  }); // jQuery End
  </code></pre>