PDA

View Full Version : Resolved play / pause button switch



gcraparotta
05-07-2009, 12:02 AM
Hi, thanks in advance for reading this.
Please visit:
http://www.cooltester.com/play-pause/siciliano.html
As you can see, there's a jquery-based photogallery in there.
It all works ok but the "play" button. I want it to switch to a "pause" button and again to the "play" button at any click. Basically I want the very conventional behaviour for web photogalleries and stuff like that.

How can that be achieved? Very grateful for any solution. Shall I intervene on the JS code contained in the HTML page? Or in the attached JS file named simplegallery.js ? Of course the "pause" button image is contained in the image folder and it is named "pause.gif" .

Thank you and may I ask you to specify CLEARLY code spots I should intervene on.

Cheers,
G

vwphillips
05-07-2009, 08:03 AM
<html>

<head>
<title></title>
<script type="text/javascript">
function pp(img){
if (img.src.indexOf('play')>=0) img.src=img.src.replace('play','pause');
else img.src=img.src.replace('pause','play');
}
</script>
</head>

<body>
<li><a href="javascript:mygallery.navigate('playpause')"><img src="imgs/controls/play.gif" onclick="pp(this);"/></a></li>

</body>

</html>

gcraparotta
05-13-2009, 02:50 PM
Thank you vwphillips!

vince164
07-25-2010, 02:50 PM
Hi is there a way to make this script also play and pause a embeded wav file