Close and redirect to link or URL

1,295 views
Skip to first unread message

sen

unread,
Aug 20, 2010, 5:32:38 AM8/20/10
to fancybox
Hi,


When Close button is clicked - i need to close (FB) and redirect to
another url.
is it possible. ?!

Kindly help me where should implement the code. as im new to
scripting. :)

Thank you for your time.

Hoping i can get some help.

- Sen


Marco Limas

unread,
Aug 20, 2010, 1:28:07 PM8/20/10
to fanc...@googlegroups.com
yes there is a, onClosed option on fancybox api options, there you can put a function to go to the link.

some seudocode:

'onClosed': function(){gotomyurl}
 

using this property

windows.location = url to redirect

 



--
You received this message because you are subscribed to the Google Groups "fancybox" group.
To post to this group, send email to fanc...@googlegroups.com.
To unsubscribe from this group, send email to fancybox+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/fancybox?hl=en.


Kumar

unread,
Aug 21, 2010, 12:22:42 AM8/21/10
to fanc...@googlegroups.com
Thank you marco, works fine!!! :)

and thank you for quick reply,that helped me to switch to my next work.

I am an advantage for the second option,

2. FB automatically close and redirect to url is 10 sec, is that too possible.

thank you for time in this matter.
-Sen

Marco Limas

unread,
Aug 21, 2010, 12:40:31 AM8/21/10
to fanc...@googlegroups.com


you can use the setTimeout function of javascript to add a delay.

Kumar

unread,
Aug 21, 2010, 11:01:09 AM8/21/10
to fanc...@googlegroups.com
Hi,

Please guide me - what/where i m wrong.

Result : FB is not working

On - jquery.fancybox-1.3.1.js
        onClosed            :    funtion(){doRedirect();},

-------------------------------
I have used this code in the html, where the fb function is running.

<script language="JavaScript">
<!--

var sTargetURL = "http://www.google.com/";

function doRedirect()
{
    setTimeout( "timedRedirect()", 5*1000 );
}

function timedRedirect()
{
    window.location.href = sTargetURL;
}

//-->
</script>


Thank so much for your attention on my issue.

Thankfully :)
Sen

Marco Limas

unread,
Aug 21, 2010, 11:27:07 AM8/21/10
to fanc...@googlegroups.com
a ; after timeRedirect()

before:

 setTimeout( "timedRedirect()", 5*1000 );

after:

Kumar

unread,
Aug 21, 2010, 11:43:35 AM8/21/10
to fanc...@googlegroups.com
Hi Marco Limas

Still the same issue - should i implement the java script on (jquery.fancybox-1.3.1.js) file


On - jquery.fancybox-1.3.1.js
        onClosed            :    funtion(){doRedirect();}, 

is the above code is rite ?!

Thank you
- Sen

Marco Limas

unread,
Aug 21, 2010, 11:47:20 AM8/21/10
to fanc...@googlegroups.com
ok please post the entire javascript code to see all

Kumar

unread,
Aug 21, 2010, 11:59:08 AM8/21/10
to fanc...@googlegroups.com
Hi Marco Limas

Still the same issue - should i implement the java script on (jquery.fancybox-1.3.1.js) file


On - jquery.fancybox-1.3.1.js
        onClosed            :    funtion(){doRedirect();}, 

is the above code is rite ?!

I have used this below (js)code in the html, where the fb function is running.


<script language="JavaScript">
<!--

var sTargetURL = "http://www.google.com/";

function doRedirect()
{
    setTimeout( "timedRedirect()", 5*1000 );
}

function timedRedirect()
{
    window.location.href = sTargetURL;
}

//-->
</script>

Thank you!!!
 
-Sen




 

Marco Limas

unread,
Aug 21, 2010, 7:03:14 PM8/21/10
to fanc...@googlegroups.com
the code works i have tested... look what i have and see if  you have some sintaxis error:

first:


<script type="text/javascript">

var sTargetURL = "http://www.google.com/";

function doRedirect()
{
    setTimeout( "timedRedirect()", 5*1000 );
}

function timedRedirect()
{
    window.location.href = sTargetURL;
}

</script>


then on document ready:


<script type="text/javascript">
$(document).ready(function(){$("a.fancy").fancybox({'type': 'iframe', 'height':400, 'width':550, 'autoScale': false, 'autoDimensions': false, 'padding':0, 'margin':0, 'overlayOpacity':0, 'overlayColor':'#000', 'opacity': true, 'onClosed':function(){doRedirect();}
});// end of fancybox function
});// end of ready function
</script>
Reply all
Reply to author
Forward
0 new messages