Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Animated Images stop looping on click

Status
Not open for further replies.

altendew

Programmer
Mar 29, 2005
154
US
Hi I have an animated image on my site and when you click on it opens a popup. I noticed right when I click on the popup the animated stops, and I need the animated to remain looping even when click on on the image.

I currently have the code for one of my Animated Images...

Code:
<a href="javascript:openWindow('[URL unfurl="true"]http://domain.com/referralCodes.php?bannerSize=468x60',[/URL] 550, 480);" onMouseOver="window.status='Click here to for instructions on how to use this banner.'; return true" onMouseOut="window.status=''; return true"><img src="[URL unfurl="true"]http://domain.com/banners/bannerAnimated_468x60.gif"[/URL] width="468" height="60" border="0"></a>

If needed...

Code:
<script type="text/javascript"> 
var OpenedWin;
function openWindow(URL,w,h,atEnd)
{
	if(!/\?/.test(URL))
	{
		URL = URL+'?';
	}

	if(/^http:\/\/[URL unfurl="true"]www/.test(window.location))[/URL]
	{
		URL = URL.replace(/^http:\/\//, "[URL unfurl="true"]http://www.")[/URL]
	}

	if(!atEnd) { atEnd = ''; }

	OpenedWin = window.open(URL+'&bar=Members'+atEnd+'', 'go'+w+h+'', 'width='+w+',height='+h+',top='+(screen.height-h)/2+',left='+(screen.width-w)/2+',screenX='+(screen.width-w)/2+',screenY='+(screen.height-h)/2+',location=0,directories=0,status=no,menuBar=no,scrollBars=yes,resizable=1');
	OpenedWin.focus();
}
 
You'll probably have to cancel the effect of the right click to do this... even then, it would be browser dependant as to whether the image stopped animating or not (some browsers may always stop what they are doing, some may not).

Try playing with oncontextmenu and returning false - see if that gets you anywhere (ask in forum216 - the JavaScript forum - for more help on this).

That aside - is it only IE you are seeing this in? I don't see the animations stopping in Firefox when I right-click.

Hope this helps,
Dan

[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
No no not right click, just click on the image.

I tested it in Opera and it works, but IE it stops when I click on the image.

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top