My designer handed me a design I'm not 100% sure how to do with jquery and css. I am basicly trying to allow a user to "slide" the footer up to reveal more conent.
My html..
<div id="footer">
<div id="expandingFooter"> hidden content</div>
content that is always visible
</div>
I have a toggle button that onclick
$('#expandingFooter').slideToggle();
This slides the expanding footer content open downward, then slides back up to close. I would like it to slide up and then close down.
Thanks
The jQuery slideUp() method is used to slide up an element. Syntax: $(selector). slideUp(speed,callback);
The slideDown() method slides-down (shows) the selected elements. Note: slideDown() works on elements hidden with jQuery methods and display:none in CSS (but not visibility:hidden). Tip: To slide-up (hide) elements, look at the slideUp() method.
jQuery | slideDown() Method The slideDown() Method in jQuery is used to check the visibility of selected elements or to show the hidden elements.
You can leverage JQuery UI 1.6's Effects (Effects Demo Page). The following accomplished the desired effect for me.
$('#toggleButton').bind('click', function(e) {
$('#expandingFooter').toggle(
'slide',
{ easing: 'easeOutQuint', direction: 'down' },
1000
);
});
Note: You may want to play with the easing parameter to get the desired smoothness of the effect.
You'll need to have the latest versions of both JQuery and JQuery UI Slide Effect to do this.
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