विस्तारित जवाब, क्या मेरा पहला जवाब था, अगर कोई पर्याप्त विस्तार नहीं हुआ था।
बूटस्ट्रैप 3.x के लिए, मैं व्यक्तिगत रूप से CSS एनिमेशन को पसंद करता हूं और मैं ast.css का उपयोग कर रहा हूं और बूटस्ट्रैप ड्रॉपडाउन जावास्क्रिप्ट हुक के साथ। हालांकि यह बिल्कुल प्रभाव नहीं हो सकता है क्योंकि यह एक सुंदर लचीला दृष्टिकोण है।
चरण 1: शीर्षक के साथ अपने पृष्ठ पर animate.css जोड़ें:
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.4.0/animate.min.css">
चरण 2: ट्रिगर पर मानक बूटस्ट्रैप HTML का उपयोग करें:
<div class="dropdown">
<button type="button" data-toggle="dropdown">Dropdown trigger</button>
<ul class="dropdown-menu">
...
</ul>
</div>
चरण 3: फिर ड्रॉपड्रॉप-मेनू तत्व में 2 कस्टम डेटा विशेषताएँ जोड़ें; एनीमेशन के लिए डेटा-ड्रॉपडाउन-इन और आउट-एनीमेशन के लिए डेटा-ड्रॉपडाउन-आउट। ये fadeIn या fadeOut जैसे किसी भी चेतन .cs प्रभाव हो सकते हैं
<ul class="dropdown-menu" data-dropdown-in="fadeIn" data-dropdown-out="fadeOut">
......
</ul>
चरण 4: डेटा-ड्रॉपडाउन-इन / आउट डेटा विशेषताओं को पढ़ने के लिए अगला जावास्क्रिप्ट जोड़ें और बूटस्ट्रैप जावास्क्रिप्ट एपीआई हुक / घटनाओं पर प्रतिक्रिया दें ( http://getbootstrap.com/javascript/#dropdowns.events ):
var dropdownSelectors = $('.dropdown, .dropup');
function dropdownEffectData(target) {
var effectInDefault = null,
effectOutDefault = null;
var dropdown = $(target),
dropdownMenu = $('.dropdown-menu', target);
var parentUl = dropdown.parents('ul.nav');
if (parentUl.size() > 0) {
effectInDefault = parentUl.data('dropdown-in') || null;
effectOutDefault = parentUl.data('dropdown-out') || null;
}
return {
target: target,
dropdown: dropdown,
dropdownMenu: dropdownMenu,
effectIn: dropdownMenu.data('dropdown-in') || effectInDefault,
effectOut: dropdownMenu.data('dropdown-out') || effectOutDefault,
};
}
function dropdownEffectStart(data, effectToStart) {
if (effectToStart) {
data.dropdown.addClass('dropdown-animating');
data.dropdownMenu.addClass('animated');
data.dropdownMenu.addClass(effectToStart);
}
}
function dropdownEffectEnd(data, callbackFunc) {
var animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
data.dropdown.one(animationEnd, function() {
data.dropdown.removeClass('dropdown-animating');
data.dropdownMenu.removeClass('animated');
data.dropdownMenu.removeClass(data.effectIn);
data.dropdownMenu.removeClass(data.effectOut);
if(typeof callbackFunc == 'function'){
callbackFunc();
}
});
}
dropdownSelectors.on({
"show.bs.dropdown": function () {
var dropdown = dropdownEffectData(this);
dropdownEffectStart(dropdown, dropdown.effectIn);
},
"shown.bs.dropdown": function () {
var dropdown = dropdownEffectData(this);
if (dropdown.effectIn && dropdown.effectOut) {
dropdownEffectEnd(dropdown, function() {});
}
},
"hide.bs.dropdown": function(e) {
var dropdown = dropdownEffectData(this);
if (dropdown.effectOut) {
e.preventDefault();
dropdownEffectStart(dropdown, dropdown.effectOut);
dropdownEffectEnd(dropdown, function() {
dropdown.dropdown.removeClass('open');
});
}
},
});
चरण 5 (वैकल्पिक): यदि आप एनीमेशन को गति देना या बदलना चाहते हैं, तो आप निम्नलिखित की तरह CSS के साथ ऐसा कर सकते हैं:
.dropdown-menu.animated {
-webkit-animation-duration: 0.55s;
animation-duration: 0.55s;
-webkit-animation-timing-function: ease;
animation-timing-function: ease;
}
अधिक विवरण और यदि कोई दिलचस्पी रखता है तो एक डाउनलोड के साथ एक लेख लिखा: लेख: http://bootbites.com/tutorials/bootstrap-dropdown-effects-animatecss
आशा है कि उपयोगी है और इस दूसरे लेखन में टॉम के लिए आवश्यक विवरण का स्तर है