Href=“#” Don't Scroll

后端 未结 11 2286
暗喜
暗喜 2020-12-05 01:55

I am pretty new to JS - so just wondering whether you know how to solve this problem.

Current I have in my code



        
11条回答
  •  误落风尘
    2020-12-05 02:15

    The easiest way to solve this problem is to just add another character after the pound symbol like this:

    close
    

    Problem solved. Yes, it was that easy. Some may hate this answer, but they cannot deny that it works.

    Just make sure you don't actually have a section assigned to "a" or it will go to that part of the page. (I don't see this as often as I use to, though) "#" by itself, by default, goes to the top of the page.

提交回复
热议问题