如何在不使用引导程序的情况下使用scrollspy [英] how to use scrollspy without using bootstrap
问题描述
有人知道如何在不使用引导程序的情况下使用scrollspy吗? 我正在尝试使用此存储库在我的一个项目中使用它:
Does anyone know how to use scrollspy without using bootstrap? I am trying to get this to work in one of my projects using this repository:
https://github.com/sxalexander/jquery-scrollspy
但是它只是不执行引导程序的操作. li 标记未标记为活动:( 任何帮助将不胜感激.
but it just doesn't do what the bootstrap one does. The li tags are not marked as active :( Any help would be appreciated.
我尝试这样做:
$('#intel_nav').scrollspy({
//n: $('#nav').offset().top,
onEnter: function (element, position) {
console.log(element);
$("#intel_nav").addClass('moo');
},
onLeave: function (element, position) {
$("#intel_nav").removeClass('out');
}
});
该元素似乎是实际菜单,所以我不知道如何实际获取当前悬停的元素的ID.
The element appears to be the actual menu, so I have no idea how to actually get the id of the element I am currently hovering over.
推荐答案
为解决此问题,我编写了自己的插件. 可以在这里找到:
To fix this, I wrote my own plugin. Which can be found here:
https://github.com/r3plica/Scrollspy
这篇关于如何在不使用引导程序的情况下使用scrollspy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!