You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 7, 2025. It is now read-only.
I use cloud reader lite to display an epub. Since there is no support for content tagged epub:type noteref, I made it myself (based on a script from epub.js) and I add it inside the epub content.
This works really fine on desktop, there is a small popover displayed on mouseover near the word to be defined. But on tablet, there is no onmouseover event, just the click event.
And when I click a link, the link is followed, whether it's an external link or an anchor.
varlinks=document.getElementsByTagName('a');for(vari=0;i<links.length;i++){if(links[i].getAttribute('epub:type')==='noteref'){links[i].addEventListener("mouseover",showPop,false);links[i].addEventListener("mouseout",hidePop,false);links[i].addEventListener("click",disableClick,false);}}functiondisableClick(e){console.log('I was clicked');e.preventDefault();e.stopPropagation();}
"I was clicked" is displayed but the preventDefault() does nothing, the click event is not stopped.
How can I prevent a link in the epub to open a new tab or to go the corresponding anchor ?