原來是自定義滾動條屏蔽了系統的這一特性。html
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style> .content{ width: 200px; height: 150px; padding-left: 10px; border: 1px solid #ccc; overflow-y: hidden; } .content:hover{ overflow-y: auto; } .scrollbar::-webkit-scrollbar { width: 2px; } .scrollbar::-webkit-scrollbar-track-piece { background-color: #fff; } /* 滾動條的內層滑軌背景顏色 */ .scrollbar::-webkit-scrollbar-track { background-color: #fff; } /* 滾動條的外層滑軌背景顏色 */ .scrollbar::-webkit-scrollbar-thumb { background-color: #d4d8e2; } /* 滾動條的內層滑塊顏色 */ .scrollbar::-webkit-scrollbar-button { background-color: #fff; display: none; } /* 滑軌兩頭的監聽按鈕顏色 */ </style> </head> <body> <div class="content scrollbar"> <p>內容1</p> <p>內容2</p> <p>內容3</p> <p>內容4</p> <p>內容5</p> <p>內容6</p> <p>內容7</p> </div> </body> </html>