Jump to content

I'm trying to auto close a pop up (lightbox)


Recommended Posts

Hello,I'm trying to automatically close a lightbox that I have on my home page. With some help, I used the setTimer. However, it still doesn't close automatically. Any idea what's wrong? Thanks.

			<script type="text/javascript" src="/jquery.min.js"></script>	<script type="text/javascript" src="/jquery.mousewheel-3.0.4.pack.js"></script>	<script type="text/javascript" src="jquery.fancybox-1.3.4.pack.js"></script>	<link rel="stylesheet" type="text/css" href="jquery.fancybox-1.3.4.css" media="screen" /><script type = "text/javascript">function setCookie(isName,isVal) {	document.cookie = isName + "=" + isVal + ";expires="  + "path=/";}function getCookie(isName){	cookieStr = document.cookie;	startSlice = cookieStr.indexOf(isName+"=");	if (startSlice == -1) {return null;}	endSlice = cookieStr.indexOf(";",startSlice+1);	if (endSlice == -1){endSlice = cookieStr.length}	isData = cookieStr.substring(startSlice,endSlice)	isValue = isData.substring(isData.indexOf("=")+1,isData.length);	return isValue;}function setTimer() {setTimeout(closepopup, 5000);  // 5 seconds}function closepopup(){ if(my_window.closed == false) {	my_window.close (); } else {alert('Window already closed!'); }}$(document).ready(function() {	if ( getCookie('myCookie') != null ) return; // no light box!	setCookie('myCookie', 'ANY VALUE'); // for next time	$("a#onload").fancybox({		'frameHeight':	390,		'frameWidth':	640,		'hideOnContentClick': false,		'easingIn': 2000			}).trigger('click'); 		});</script>	 <div style="display: none;" id="lightbox_content"> <div id="data"><a href=""><img height="333" width="625" src="lightbox1.jpg" alt="" title="Lightbox" /></a> 			<a id="onload" href="#data"></a>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...