在某些链接标记上禁用js

时间:2014-12-31 17:07:38

标签: javascript scrollto

你好,新年快乐,

我有一个使用scrollto插件的菜单(* http://flesler.blogspot.com/2007/10/jqueryscrollto.html)。

我的页面是onePager-Template,每个菜单项都会单击,滚动到特定区域。

我想在某些a标签上禁用此功能(或任何js),如下所示:

// normal behaviour / srolls to page (anchor link with scrollTo Plugin)

<a href="#page-area">Area</a>

// disabled behaviour

<a href="http://www.test.com" onclick="// disable js on this tag">Another Area</a>

但我不知道该怎么做。

我只知道像$(self).preventDefault这样的东西可以关闭js行为。

有人可以用oneliner帮助我吗?

谢谢!!!!!

1 个答案:

答案 0 :(得分:0)

我最终得到了这个片段:

    <a href="/blog.html" onclick="window.open(this.href, '_self', ''); return false;">Blog</a>

所以这会被触发并覆盖我模板中任何其他脚本的行为。