PDA

View Full Version : Jquery attaching to a play button



louisaivy
10-09-2011, 01:43 AM
Hi, i have a javascript gallery that when a play button is pressed the images cycle through, i have this piece of jquery to fade the images in and out once the play button has been pressed. But i need to attached it to the play button still in order for it to work, can anyone help me out?


If you can help me, thankyou
[/CODE]

louisaivy
10-09-2011, 02:25 AM
I have been trying to add something like this

$('#play').click(function(){
in the second line, am i on the right track at all?

jscheuer1
10-09-2011, 03:25 AM
This has less meaning than it could if we could see the markup.

But, assuming you know what you want in a general sort of way and the markup and other code support it, one could do:


$('#captionarea').hide();
$('#play').click(function(){
$('img#slide').fadeTo(500,0.05,function(){
$('#slide').attr('src','Assets/images/big/'+i+'.jpg');
$('#slide').fadeTo(500,1,function(){
$('#captionarea').show();
});
});
});

It might make more sense to:


$('#play').click(function(){
$('#captionarea').hide();
$('img#slide').fadeTo(500,0.05,function(){
$('#slide').attr('src','Assets/images/big/'+i+'.jpg');
$('#slide').fadeTo(500,1,function(){
$('#captionarea').show();
});
});
});

Either way, the play button would need to have already been parsed by the browser.

If you want more help:

Please post a link to a page on your site that contains the problematic code so we can check it out.