signalstoerung / reader

MIT License
0 stars 0 forks source link

Mobile: href=“#” #8

Closed signalstoerung closed 10 months ago

signalstoerung commented 10 months ago

Jumps to the top of the page

signalstoerung commented 10 months ago

help from ChatGPT:

To prevent the page from scrolling to the top when clicking on a link with href="#", you can modify the JavaScript function to return false. Here's an example:

<a href="#" onclick="yourJavaScriptFunction(); return false;">Link Text</a>

By adding return false; to the onclick attribute, it will prevent the default behavior of the link, which is to navigate to the top of the page. Your JavaScript function will still be executed, and the link will visually behave like a link.