The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Pop-up show on page load

5 posters

Go down

Pop-up show on page load Empty Pop-up show on page load

Post by ioncube October 6th 2011, 8:12 pm

I have already worked on this pop-up:
https://defencedog.googlecode.com/svn/welcomebox/jquery_welcome_box.html

but I still considers a lightweight replacement so here it goes
https://defencedog.googlecode.com/svn/simplewelcome/my.html

as you can see the popup show at click event; I want it to load automatically when page loads & can't find the appropriate method:

Here my failed tries...

Code:
$(document).ready(function () {
  //id is the ID for the DIV you want to display it as modal window
  launchWindow(dialog); 
 
      //Get the screen height and width
      var maskHeight = $(document).height();
      var maskWidth = $(window).width();
   
      //Set heigth and width to mask to fill up the whole screen
      $('#mask').css({'width':maskWidth,'height':maskHeight});
      
      //transition effect      
      $('#mask').fadeIn(1000);   
      $('#mask').fadeTo("slow",0.8);   
   
      //Get the window height and width
      var winH = $(window).height();
      var winW = $(window).width();
             
      //Set the popup window to center
      $(dialog).css('top',  winH/2-$(dialog).height()/2);
      $(dialog).css('left', winW/2-$(dialog).width()/2);
   
      //transition effect
      $(dialog).fadeIn(2000);
   
   
   
   //if close button is clicked
   $('.window .close').click(function (e) {
      //Cancel the link behavior
      e.preventDefault();
      
      $('#mask').hide();
      $('.window').hide();
   });      
   
   //if mask is clicked
   $('#mask').click(function () {
      $(this).hide();
      $('.window').hide();
   });            
});
ioncube
ioncube
Forumember

Male Posts : 279
Reputation : 41
Language : eng
Location : Pakistan

http://defencedog.blogspot.com/

Back to top Go down

Pop-up show on page load Empty Re: Pop-up show on page load

Post by LGforum October 7th 2011, 12:33 am

You can add an onload event to the body tag.

<body onload="your function here">
LGforum
LGforum
Hyperactive

Male Posts : 2265
Reputation : 264
Language : English
Location : UK

Back to top Go down

Pop-up show on page load Empty Re: Pop-up show on page load

Post by ^_lilmhack_^ October 8th 2011, 7:22 am

how to add this code??
avatar
^_lilmhack_^
New Member

Posts : 16
Reputation : 1
Language : Pinoy

Back to top Go down

Pop-up show on page load Empty Re: Pop-up show on page load

Post by ioncube October 8th 2011, 11:04 pm

Got it cleared via:
Code:

   $('a[href=#welcome]').click();    // for multi-popups initiation
    $('a[name=modal]').click();  // for name initiation will initiate all popups included
ioncube
ioncube
Forumember

Male Posts : 279
Reputation : 41
Language : eng
Location : Pakistan

http://defencedog.blogspot.com/

Back to top Go down

Pop-up show on page load Empty Re: Pop-up show on page load

Post by Bayat October 9th 2011, 5:12 am

^_lilmhack_^ wrote:how to add this code??

Hi,
Please do not use boldface text. That is strictly reserved for forumotion staff only.

Regards,
Bayat Smile
Bayat
Bayat
New Member

Posts : 17
Reputation : 1
Language : English, French

Back to top Go down

Pop-up show on page load Empty Re: Pop-up show on page load

Post by Sanket October 9th 2011, 7:19 am

Bayat, Please don't moderate other members, as this is reserved for staff only Wink

Since you being on a one strike rule, you are being banned.
Sanket
Sanket
ForumGuru

Male Posts : 48766
Reputation : 2830
Language : English
Location : Mumbai

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum