2013-08-25 34 views
2

我目前正在开发一个网站的前端,它是单个页面,在div之间平滑滚动。为平滑滚动网站禁用滚动条

我想禁用鼠标本身的滚动。

我知道overflow:hidden;删除滚动条,但是,我希望页面滚动时,只有当他们点击链接到所需的div。什么是正确的方式去做呢?

回答

0

试试这个:

<script type="text/javascript"> 
if(window.addEventListener){ 
    window.addEventListener('DOMMouseScroll',wheel,false); 
} 

function wheel(event) 
{ 
    event.preventDefault(); 
    event.returnValue=false; 
} 
window.onmousewheel=document.onmousewheel=wheel; 
</script>