我在我正在处理的项目中使用 Twitter 的 Bootstrap 'Collapse' 插件。我有一个简单的 Accordion (设置 as per the documentation),但我想从 修改默认功能点击到悬停 事件。
谁能确认实现这一目标的最佳方法?
最佳答案
我实现了悬停功能,同时相当容易地保持“可点击性”:
jQuery(".pointer").hover(
function(){
var thisdiv = jQuery(this).attr("data-target")
jQuery(thisdiv).collapse("show");
},
function(){
var thisdiv = jQuery(this).attr("data-target")
jQuery(thisdiv).collapse("hide");
}
);
我已经在使用数据属性,所以我保留了它们,并在这里使用它们来触发正确的 div。 “指针”是我的切换链接上的一个类,因此您可以根据需要对其进行调整。
关于twitter-bootstrap - Bootstrap 在悬停时折叠 Accordion ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10719931/