---
# System prepended metadata

title: 阻止點擊a時頁面彈跳到頂部 stop a web page from scrolling to the top
tags: [網頁優化, 網頁前端]

---

###### tags: `網頁優化` `網頁前端`

# 阻止點擊a時頁面彈跳到頂部 stop a web page from scrolling to the top


[How do I stop a web page from scrolling to the top when a link is clicked that triggers JavaScript?](https://stackoverflow.com/questions/1601933/how-do-i-stop-a-web-page-from-scrolling-to-the-top-when-a-link-is-clicked-that-t)


#### 關閉close [x] button時 , 發現會彈跳到網頁頂部 ,阻止畫面彈跳方法

原本

 `<a class="closeup " href="#">&times;</a>`
 
 改成
 
`  <a class="closeup " href="#!">&times;</a>`

#### 試試 **href="#!"**