I just created this: jsfiddle.net/MWzDe/,
the JS:
$('button').click(function () {
if ($('ul').height = 0) {
$('ul').animate({'height':'100%'},'slow');
} else {
$('ul').animate({'height': 0},'slow');
}});
I need to slide the 'ul' tag Up/Down without 'really' disappearing it. What's wrong with the code? doesn't make it yet. thanks.
.height
is a function: use $('ul').height()
to get the height like this
if ($('ul').height() == 0) {
}
You can achieve this just using slideToggle
.
Try this:
$('button').click(function () {
$("ul").slideToggle("slow");
});
Fiddle: http://jsfiddle.net/MWzDe/3/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With