Reputation: 776
$('.shutter').bind("click", function () {
$(".expander").slideToggle("800", "easeOutCubic");
});
but if I do not want the expander's height= 0;
If I want the height = 20px
(offset) after applying slide up, so my question is that, is there any possible way to set Offset in toggleSlide method or any alternate? Like:
$('.shutter').bind("click", function () {
$(".expander").slideToggle{20, ("800", "easeOutCubic")};
});
I know above example is not the correct one, but it just an example to show you what I want..
Upvotes: 0
Views: 897
Reputation: 6854
For applying height: 20px;
after the slideToggle
, add a callback:
$('.shutter').bind("click", function() {
$(".expander").slideToggle("800", "easeOutCubic", function() {
$(this).css({'height':'20px'});
});
});
UPDATE: After comments, you have used the easeOutCubic
improperly, instead use it like:
$('.shutter').bind('click', function() {
if($('.expander').attr('style') == 'height: 20px;') {
$('.expander').animate({'height':'200px'}, 800);
} else {
$('.expander').animate({'height':'20px'}, 800);
}
});
Here's a JSFiddle
Upvotes: 1