禁用下拉菜单过渡效果(JS)
Disable dropdown menu transition effect (JS)
我想完全禁用下拉菜单中的过渡效果,这是我认为必须更改的 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")
}
}
}
可能是 this which is a duplicate of this post
的副本
如果你不想跳过去阅读,这里是你应该添加的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)
(内部没有引号,因为它是一个数值)而不是 'slow'。这应该基本上禁用动画。
我想完全禁用下拉菜单中的过渡效果,这是我认为必须更改的 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")
}
}
}
可能是 this which is a duplicate of this post
的副本如果你不想跳过去阅读,这里是你应该添加的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)
(内部没有引号,因为它是一个数值)而不是 'slow'。这应该基本上禁用动画。