Can someone help me out with this one. I have a page, in which is a menu, which I am performing some js stuff on links containing the class ‘opener’.
Every link works great, except non-‘opener’ links (aka… external links), these seem to do nothing.
Can you tell me what I’m doing wrong here:
http://new.o7thwebdesign.com
if you click on ‘Test 1’, the page goes to an internal page as it should. (note, ‘External’ only exists on the home page, so you’ll need to click ‘Home’)
if you click on ‘External’ it does not do anything.
In the script
h.basic.jsyou have the following code:The
return false;prevents the default action of the event which was a click on a link. Try the following instead:The changed line being:
That is a bit confusing but it looks at the target element of the event (The anchor being clicked) and then looks at it’s target property which is set using the target attribute of your
<a>tag. If it is_blankthen it returns true, otherwise it returns false. So links withtarget="_blank"will retain the default behaviour, while links without that will supress it.