double click jquery toggle
Hello all,
I have a div that I want to toggle and I also want the button image to change when the div is toggled, I have this working but the problem is the user has to double click the button to hide and double click to show if you go here you can see an example.
http://thegamegetaway.com/test2/test.html
here is my code:
-
$(document).ready(function(){
$("#additional_details_div").click(function () {
$('#additional_details_div').toggle(
function(){
$('#additional_details_btn').attr('src','img/btn_hide-up.gif');
$('#additional_details').css('display','block');
}, function() {
$('#additional_details_btn').attr('src','img/btn_show-up.gif');
$('#additional_details').css('display','none');
});
});
});
any help is greatly appreciated