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 10-17-2012, 01:21 AM   PM User | #1
vorl
Regular Coder

 
Join Date: Feb 2005
Posts: 190
Thanks: 25
Thanked 0 Times in 0 Posts
vorl is an unknown quantity at this point
on submit, show Fancybox after 5 seconds

Hi again

This probably is easy but I cant see where im going wrong.

So what is supposed to happen is that onsubmit there is a 5 second wait before the fancybox function opens. The problem I have is when I try to add the setTimeout function and I bet its something easy but I cant get it to work.

Code im using is below. Anybody help me out please?

Thanks!

Code:
$(document).ready(function(){
//---
$("form").submit(function(e){

	setTimeout(function (){

		$.fancybox({
		 'href' : '#loading-wait',   
		 'width' : 650,
		 'height' : 350,
		 'autoScale' : false,
		 'transitionIn' : 'none',
		 'transitionOut' : 'none',
		 'scrolling' : 'no',		 
		 'type' : 'inline',
		 'showCloseButton' : false,
		 'hideOnOverlayClick' : false,
		 'hideOnContentClick' : false    
		 })
		 
                 return false;
	})
	
        , 5000 );

});

});
vorl is offline   Reply With Quote
Old 10-17-2012, 07:06 AM   PM User | #2
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
devnull69 will become famous soon enough
Move the "return false" from inside the setTimeout to the last line of the submit event handler. Additionally, there is one additional closing bracket that needs to be removed
Code:
$("form").submit(function(e){

	setTimeout(function (){

		$.fancybox({
		 'href' : '#loading-wait',   
		 'width' : 650,
		 'height' : 350,
		 'autoScale' : false,
		 'transitionIn' : 'none',
		 'transitionOut' : 'none',
		 'scrolling' : 'no',		 
		 'type' : 'inline',
		 'showCloseButton' : false,
		 'hideOnOverlayClick' : false,
		 'hideOnContentClick' : false    
		 })
		 
        }, 5000 );

        return false;

});

Last edited by devnull69; 10-17-2012 at 07:08 AM..
devnull69 is offline   Reply With Quote
Users who have thanked devnull69 for this post:
vorl (10-20-2012)
Old 10-20-2012, 01:31 PM   PM User | #3
vorl
Regular Coder

 
Join Date: Feb 2005
Posts: 190
Thanks: 25
Thanked 0 Times in 0 Posts
vorl is an unknown quantity at this point
Thank you so much!
vorl is offline   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 01:23 PM.


Advertisement
Log in to turn off these ads.