.click instead of document ready?

Discussion in 'jQuery' started by retwedia, Nov 8, 2011.

  1. #1
    Hello, I am a php developer. Currently I have a jquery script that loads on document ready function. I would like to make it load on a .click function.

    Could anyone help me with this?

    Current code;
    $(document).ready(function(){		
    				
    	$().socialTrafficPop({
    		timeout: 30,
    		title: "Social Traffic Pop",
    		message: 'Share my hot new Envato item "Social Traffic Pop" with your friends!',
    		google_url: "http://tyler.tc/",
    		facebook_url: "http://tyler.tc/",
    		closeable: true,
    		opacity: '0.45',
    		twitter_method: "tweet"
    	});
    	
    });
    
    Code (markup):

     
    retwedia, Nov 8, 2011 IP
  2. aTo

    aTo Active Member

    Messages:
    473
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    78
    #2
    
    $(document).ready(function(){		
    	
       $("#handler").click({			
    	$("#handler").socialTrafficPop({
    		timeout: 30,
    		title: "Social Traffic Pop",
    		message: 'Share my hot new Envato item "Social Traffic Pop" with your friends!',
    		google_url: "http://tyler.tc/",
    		facebook_url: "http://tyler.tc/",
    		closeable: true,
    		opacity: '0.45',
    		twitter_method: "tweet"
    	});
        });
    });
    
    Code (markup):
    Try this :)
     
    aTo, Nov 9, 2011 IP
  3. retwedia

    retwedia Member

    Messages:
    196
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    48
    #3
    Thanks a lot for the reply! I tried the provided code with no prevail.
    Thanks for your effort though.
     
    retwedia, Nov 9, 2011 IP