ZenQuest
asked on
How to expand / collapse an area on a webpage using HTML / CSS or ???
Does anyone know if there is a documented / standard practice for achieving the show / hide feature at the bottom of this webpage.
I'm curious how they're doing that.
http://www.dart.org/
Thanks in advance!
-Lance
I'm curious how they're doing that.
http://www.dart.org/
Thanks in advance!
-Lance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
jmnf is totally right, you just need jQuery slideUp and slideDown : http://jsfiddle.net/t5eps/
//-- HIDE/SHOW BOTTOM DIV FUNCTIONS
$('#hideshowhide').click(function() {
$('#bottom .container').slideUp(400, function() {
$('#hideshowhide').addClass('hide');
$('#hideshowshow').removeClass('hide');
});
});
$('#hideshowshow').click(function() {
$('#bottom .container').slideDown(400, function() {
$('#hideshowshow').addClass('hide');
$('#hideshowhide').removeClass('hide');
});
});
Or, alternatively,. you can use jQuery's slideToggle function.. and display use a button that says 'show/hide' - this code will also work just as well using individual 'hide' and 'show' button images.
This will accomplish the smooth sliding, without the added code weight :)
$('#button').click(function() {
$('#slideMe').slideToggle('slow', function() {
// Animation complete.
});
});
This will accomplish the smooth sliding, without the added code weight :)
http://www.adipalaz.com/experiments/jquery/expand.html