Snippets → jQuery Code Snippets → Combine Slide and Fade Functions Combine Slide and Fade Functions Chris Coyier on Mar 16, 2010 $.fn.slideFadeToggle = function(speed, easing, callback) { return this.animate({opacity: 'toggle', height: 'toggle'}, speed, easing, callback); }; Usage $("#something").click(function() { $(this).slideFadeToggle(); });
As if you read my thoughts. Thanks Chris :D
This is beautiful! I can imagine using this effect on many things.
Thanks!
Any demo? I would like to see it if there is some.
Thanks, m8! Your site is great! Found a lot of usefull tips!
Hello, is there any Demo to download, it doesn’t work for me.
thx for the nice post.
it’s nice , but I think it would be better if there was a demo page just like “Downloads”
This is an awesome post Chris cheers.
Excellent effect and very easy to modify!
Thanks!
Always nice to see a demo or example.
Thanks @Chris.
@Amir Monfared: there you go, http://jsfiddle.net/jeykeu/ejcn8/
Thanks once again Chris. Over & over again I find what I’m looking for through your site.
Thanks a lot Chris! Nice work
Nice one, just in case someone else wants to use this:
You might want to add
padding: 'toggle'
in order to prevent a jumpy animation when you’re using paddings on the element you want to toggle.Check out the working demo here
http://codepen.io/np24/pen/biqtE
Thanks,
Nithin
Here are the corresponding functions for explicitly “slide-fading” in or out.
Hey Guys,
If I want this to toggle between display: none and display: flex with all the proper compatibility, is that possible? Or should I just create a new element within to display: flex ?
It’ll be better to wrap your ‘flex’-element to another one with display:block and use this function on it.
This is better achieved in css;
CSS:
.slide {
position: relative;
left: 50%;
height: 20px;
animation: 5s slide;
}
@keyframes slide {
from: { left: 100%; opacity: 0; }
to: { left: 50%; opacity: 1; }
}
submenu……….
How to convert this to use slideUp?