When a user slides the jQuery Slider over, it effects each image. How do I only get the images pertaining to that slider to change?
I’ve tried:
$(this).closest('img.down') and $(this).siblings('img.down')
$("#slider").slider({
value:50,
min: 0,
max: 100,
step: 50,
slide: function( event, ui ) {
$('img.up, img.down').css('opacity','.4');
if (ui.value >= 51) {
$('img.up').css('opacity','.8');
}
if (ui.value <= 49) {
$('img.down').css('opacity','.8');
}
}
});
Thanks guys!
You need to make a change to your markup, you cannot have three items in a page with the same id. You can make it
Move the initialization of the CSS outside of the function then traverse the markup to get the correct image:
http://jsfiddle.net/psybJ/9/