Getting jQuery Toggle to close once thumb is clicked
Really need to get 开发者_JAVA百科this fixed, I'm trying to make it so if you click on one of the smaller thumbnails the image collection toggle will close, I've managed to make it close if you click the toggle im having trouble with this, please see link if needed http://www.media21a.co.uk/development/fullthrottle/
Thank you for any help : )
$(document).ready(function() {
$(".dropgallery a, #fp_thumbtoggle").removeAttr("title");
$('#fp_thumbtoggle').click(function() {
$('#fp_thumbtoggle').toggleClass("active");
if ($('#fp_thumbtoggle').hasClass('active')){
$('#fp_thumbtoggle').animate({top:'65px'});
}else{
$('#fp_thumbtoggle').animate({top:'185px'});
}
$('.dropgallery').slideToggle('500');
return false;
});
});
Try adding
$("#fp_thumbtoggle").click();
to the click handler for $('.thumb'). It calls the thumb toggle click handler.
This seemed to work when editing your page using firebug.
$(document).ready(function() {
$(".dropgallery a, #fp_thumbtoggle").removeAttr("title");
//Notice change below
$('#fp_thumbtoggle, .dropgallery img').click(function() {
$('#fp_thumbtoggle').toggleClass("active");
if ($('#fp_thumbtoggle').hasClass('active')){
$('#fp_thumbtoggle').animate({top:'65px'});
}else{
$('#fp_thumbtoggle').animate({top:'185px'});
}
$('.dropgallery').slideToggle('500');
return false;
});
});
精彩评论