Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-20-2011, 05:00 AM   PM User | #1
diseases
New to the CF scene

 
Join Date: Dec 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
diseases is an unknown quantity at this point
javascript onclick; the magic words?

I need this to run on click and not on load:

Code:
<script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.min.js" type="text/javascript"></script>
<script type="text/javascript">

	var Delay = 10;//Seconds after them clicking the link, the gateway vanishes. 
	function setupgateway()
	{
	        
	       
		var Left = $(window).width() /2;
                Left = Left - $('#gatewaydiv').width()/2;
		
		var Top = $(window).height() /2;
		Top = Top - $('#gatewaydiv').height()/2;
		
		$('#gatewaydiv').css('top', Top+'px').css('left', Left+'px').css('display', 'inline');
		$('#gatewayDimmer').width($('html').width());
		$('#gatewayDimmer').height($('html').height());
		$('#gatewayDimmer').css({display:'block', position:'fixed'});
	}
	
	function removegateway()
	{
		$('#gatewaydiv').css('display', 'none');
		$('#gatewayDimmer').css('display','none');
	}
	
	$(document).ready(function()
	{
		$('.offerlink').click(function()
		{
			setTimeout('removegateway()', Delay*1000);
		});
		
		setupgateway();
	});
</script>
what do i need to add?
diseases is offline   Reply With Quote
Old 12-20-2011, 05:48 AM   PM User | #2
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,292
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
Change this
Code:
	$(document).ready(function()
	{
		$('.offerlink').click(function()
		{
			setTimeout('removegateway()', Delay*1000);
		});
		
		setupgateway();
	});
to this
Code:
	$(document).ready(function()
	{
		$('.offerlink').click(function()
		{
			setupgateway();
                        setTimeout('removegateway()', Delay*1000);
		});
		
		
	});
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 12-20-2011, 05:55 AM   PM User | #3
diseases
New to the CF scene

 
Join Date: Dec 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
diseases is an unknown quantity at this point
thanks, i guess. i cant bring it up now. i want to bring it up onclick by clicking a specific image on my page. How do I do that?

**edit** nvm, I figured it out. thanks

Last edited by diseases; 12-20-2011 at 06:57 AM..
diseases is offline   Reply With Quote
Old 12-20-2011, 06:57 AM   PM User | #4
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,292
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
Right now what happens? Does it just reload the page? Try this
Code:
	$(document).ready(function()
	{
		$('.offerlink').click(function()
		{
			setupgateway();
                        setTimeout('removegateway()', Delay*1000);
                        return false;
		});
		
		
	});
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 12-20-2011, 11:13 AM   PM User | #5
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,698
Thanks: 5
Thanked 875 Times in 850 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
What has this to do with HTML or CSS?
Moved to appropriate forum.
__________________
Don’t click this link!
VIPStephan is online now   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:30 AM.


Advertisement
Log in to turn off these ads.