jquery click on anchor element forces scroll to top?

后端 未结 8 1580
故里飘歌
故里飘歌 2020-12-28 08:07

jQuery hyperlinks - href value? text][1]

I am running in to a problem using jquery and a click event attached to an anchor element. [1]: jQuery hyperlinks - href

相关标签:
8条回答
  • 2020-12-28 09:06
    $("#id_of_anchor").click(function(event) { 
      // ...
      return false;
    }
    
    0 讨论(0)
  • 2020-12-28 09:09

    just lose the

    href="#"
    

    In the a html tag... that's what causing the web page to "jump up".

    <a id="id_of_anchor"> link text </a>
    

    and remember to add

    cursor: pointer;
    

    to your a's css so it will look like a link on mouseover.

    Good luck.

    0 讨论(0)
提交回复
热议问题