在我的下拉菜单中有一个我想要完全禁用的过渡效果,这是我认为我必须更改的js代码。
function(e) {
if ((/input|textarea/i.test(e.target.tagName) ? !(32 === e.which || 27 !== e.which && (40 !== e.which && 38 !== e.which || t(e.target).closest(y).length)) : h.test(e.which)) && (e.preventDefault(), e.stopPropagation(), !this.disabled && !t(this).hasClass(u))) {
var n = a._getParentFromElement(this),
i = t(n).hasClass(f);
if ((i || 27 === e.which && 32 === e.which) && (!i || 27 !== e.which && 32 !== e.which)) {
var s = t(n).find(I).get();
if (0 !== s.length) {
var r = s.indexOf(e.target);
38 === e.which && r > 0 && r--, 40 === e.which && r < s.length - 1 && r++, r < 0 && (r = 0), s[r].focus()
}
} else {
if (27 === e.which) {
var o = t(n).find(E)[0];
t(o).trigger("focus")
}
t(this).trigger("click")
}
}
}发布于 2020-12-14 04:49:49
如果你不想跳过阅读,这里是你应该添加的CSS:
.collapsing {
-webkit-transition: none;
transition: none;
display: none;
}在发布问题之前,不要忘记先搜索答案。
编辑:您的站点使用JS/jQuery来完成此操作,这是正确的。该函数位于my-js.js文件中,如下所示:
$(document).ready(function(){
$(".dropdown").hover(
function() {
$('.dropdown-menu', this).not('.in .dropdown-menu').stop( true, true ).slideDown("low");
$(this).toggleClass('open');
},
function() {
$('.dropdown-menu', this).not('.in .dropdown-menu').stop( true, true ).slideUp("low");
$(this).toggleClass('open');
}
);
});您可以将slideDown和slideUp方法编辑为slideUp(0) (内部没有引号,因为它是一个数值),而不是‘slideUp(0)’。这实际上应该会禁用动画。
https://stackoverflow.com/questions/65280368
复制相似问题