-1

Hi there and happy new year,

I have a menu which uses the scrollto plugin ( * http://flesler.blogspot.com/2007/10/jqueryscrollto.html).

My Page is a onePager-Template and every menu item click, scrolls to a specific area.

I wanna disable this function (or any js) on certain a tags like this:

// 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>

But I have no idea how to do this.

I only know that something like this $(self).preventDefault could turn off js behaviour.

Can someone help me out with a oneliner?

Thank you!!!!!

Jan
  • 12,992
  • 9
  • 53
  • 89
  • What do you mean by disable js? You probably mean that when user clicks on the link, it doesn't follow the link? – FrEaKmAn Dec 31 '14 at 17:12
  • When user clicks, it should NOT fire any js on the tag (self) where I put this "snippet" onto. Also updated my question. – Jan Dec 31 '14 at 17:23
  • If tag already has some kind of js event (lets say onclick fires alert) you want to somehow disable this? – FrEaKmAn Dec 31 '14 at 17:24
  • possible duplicate? http://stackoverflow.com/questions/20085316/disable-all-javascript-events-on-page there are many results for this kind of problem. the whole logic is that you unbind all events from the tags – FrEaKmAn Dec 31 '14 at 17:27
  • Maybe you are looking something like this: `onclick="return false;"` – alessandrio Dec 31 '14 at 17:27
  • tried the ```return false;``` attempt without success. Now I ended up with ``` ``` Thank you all, HNY – Jan Dec 31 '14 at 17:43

1 Answers1

0

I ended up with this snippet:

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

So this gets fired and overwrites the behaviour of any other script in my template.

Jan
  • 12,992
  • 9
  • 53
  • 89