Is there any declare for toggle() that if its open do this, closed to that?
- by Dejan.S
Im doing some jquery stuff with toggle(), I'm doing different actions depending on if the current div is closing or showing, i know i can easy check if a div hasClass() or is(':visible') for what i want to do, but I'm thinking maybe there is somehow that i can reduce the amount of code or just do it more efficient? like declare the toggle() with two functions that this is for when its showing and this is for when its closing, is this possible?
hope you get what i mean?
like this, or check a jsfiddle
$('#click_me').on('click', function() {
$('#contain').toogle('blind', 300, function (){
alert('open');
}, function (){
alert('close');
});
});