简体   繁体   English

javascript链接使页面升起onclick

[英]javascript link makes the page go up onclick

I have a problem in my website, I have build a menu that consist of javascript links, When i click on link from the menu, the page goes up, You can see it here: 我的网站有问题,我建立了一个包含javascript链接的菜单,当我单击菜单中的链接时,页面上升,您可以在这里看到它:

http://www.ourevent.co.il/dj-%D7%A1%D7%98%D7%99%D7%91-%D7%9C%D7%95%D7%99-%D7%9E%D7%95%D7%A1%D7%99%D7%A7%D7%94-%D7%95%D7%94%D7%A4%D7%A7%D7%95%D7%AA http://www.ourevent.co.il/dj-%D7%A1%D7%98%D7%99%D7%91-%D7%9C%D7%95%D7%99-%D7%9E%D7 %95%D7%A1%D7%99%D7%A7%D7%94-%D7%95%D7%94%D7%A4%D7%A7%D7%95%D7%AA

I never saw it before, anyone have an idea? 我从未见过,有人知道吗?

Thanks. 谢谢。

This probably means you have a javascript error somewhere else, or you are using tags with an href of "#" and not using event.preventDefault() in your click method. 这可能意味着您在其他地方遇到了javascript错误,或者您在href方法中使用的href为“#”的标记,而未使用event.preventDefault()。 I would check the console for javascript errors, or ensure your click event is using preventDefault. 我会检查控制台中的javascript错误,或确保您的click事件正在使用preventDefault。

ex: 例如:

$('a.neat-link').click(function(event){
  event.preventDefault();
  /* do your link stuff here and it should work */ 
})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM