javascript - Append onclick to all but one link jquery -


i found code

function callback(e) {     var e = window.e || e;      if (e.target.tagname !== 'a')         return;      nanobar.go(100) }  if (document.addeventlistener)     document.addeventlistener('click', callback, false); else     document.attachevent('onclick', callback); 

it's appending onclick , nano bar appears when link on page clicked, there's nice loading effect on youtube. there's 1 link shouldn't trigger nanobar, how exclude in code?

your code has exclusion rule (in case it's ignoring events elements other <a>), add exclusion so:

if (e.target.tagname !== 'a' || e.target.href.slice(-1) === "#") //exclude hash anchors   return; 

Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -