The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Pop-up show on page load

View previous topic View next topic Go down

Pop-up show on page load

Post by ioncube on 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
Forumember

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

http://defencedog.blogspot.com/

Back to top Go down

Re: Pop-up show on page load

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

You can add an onload event to the body tag.

<body onload="your function here">

LGforum
Hyperactive

Male Posts : 2260
Reputation : 258
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Re: Pop-up show on page load

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

how to add this code??

^_lilmhack_^
New Member

Posts : 16
Reputation : 1
Language : Pinoy

Back to top Go down

Re: Pop-up show on page load

Post by ioncube on 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
Forumember

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

http://defencedog.blogspot.com/

Back to top Go down

Re: Pop-up show on page load

Post by Bayat on 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
New Member

Posts : 17
Reputation : 1
Language : English, French

Back to top Go down

Re: Pop-up show on page load

Post by Sanket on 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
ForumGuru

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

http://webartzforum.com

Back to top Go down

View previous topic View next topic Back to top


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