【发布时间】:2012-04-06 01:53:12
【问题描述】:
我的 jQuery 滚动脚本有一些问题。我已经成功地在我的单页网站顶部创建了一个固定菜单。菜单项在 jquery 页面中滚动到右侧区域,并且活动菜单项被突出显示。
问题是我想在用户手动滚动时突出显示菜单项。我认为下面的脚本可以解决这个问题,但它不起作用。
我做错了什么?
if($('#contact').offset() < $(document).scrollTop()) { // #contact is the element who one of the menu items scroll to.
$('.link-contact').css({ // The menu item
'background' : 'url(wp-content/themes/theme/images/menu.bg.png)',
'color' : '#999'
});
}
【问题讨论】: