Quick jQuery question - I need the popup to load when the page loads

Discussion in 'jQuery' started by powwka, Dec 21, 2009.

  1. #1
    Ok so I've been following this tutorial - http://yensdesign.com/2008/09/how-to-create-a-stunning-and-smooth-popup-using-jquery/
    to get a popup to fade in on my site.

    But that tutorial has the popup fade in after you click a button. I want the popup to fade in as soon as the page loads. There's got to be a quick fix to this.
    I think this is the code that needs editing:
    //CONTROLLING EVENTS IN jQuery
    $(document).ready(function(){
    	
    	//LOADING POPUP
    	//Click the button event!
    	      $("#button").load(function(){
    		//centering with css
    		centerPopup();
    		//load popup
    		$loadPopup();
    	});
    
    Code (markup):
    Can I get some help please?
     
    powwka, Dec 21, 2009 IP
  2. dimitar christoff

    dimitar christoff Active Member

    Messages:
    882
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #2
    .load is an event handler. you should be ok by removing everything within the ready except for the

    
    $(document).ready(function() {
        centerPopup();
        $loadPopup();
    });
    Code (javascript):
    of course, since i don't know what lies beyond the 2 functions you call, i can't confirm it will work or not.
     
    dimitar christoff, Dec 22, 2009 IP
  3. powwka

    powwka Peon

    Messages:
    583
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Perfect, thanks a lot!
     
    powwka, Dec 22, 2009 IP