I am trying to get the standard navbar dropdown menu on Twitter Bootstrap to fade in instead of just appear. I have tried adding the classes fade
and in
but it doesn't appear to fade. Here is my fiddle http://jsfiddle.net/byronyasgur/5zr4r/10/.
I have tried going about it another way - eg the answer on this question but I'm having trouble targeting the dropdown trigger with jquery for some reason.
Maybe doing something like this with jQuery:
You can chek the fiddle here: http://jsfiddle.net/5zr4r/15/
UPDATE: I forgot to say that you should remove the
fade
in
from theul
.I'd like to submit a modern, CSS-only approach:
This allows
.fade
to handle the transition animation, but.open
is what controls the opacity and pointer state.Playing around with this, it looks like CSS animations work the best.
You can add other CSS properties in order to make more complicated animations. For example, I've been playing with left: -30 -> left: 0.
I found nice solution too:
Example: http://codepen.io/danielyewright/pen/EvckL
You can try this:
It utilizes Bootstrap's existing
show.bs.dropdown
andhide.bs.dropdown
functions and changes the dropdown effect to "fade" in instead of "appear". You can also changefadeToggle()
toslideDown()
if you want a "slide" in effect. Hope this helps.Here is the fiddle: http://jsfiddle.net/ck5c8/
Small tweak to Jason Featheringham's answer that works in Bootstrap 4.