Home > Web Front-end > HTML Tutorial > 如何设置div滚动条不滚动的问题_html/css_WEB-ITnose

如何设置div滚动条不滚动的问题_html/css_WEB-ITnose

WBOY
Release: 2016-06-21 09:39:26
Original
1875 people have browsed it

如图我有复数件多个select下拉菜单,右边会出现一个滚动条,现在当我选中一个option后,想让滚动条不滚动怎么做?
代码如下:




....
....




我用var bar = document.all.verticalScrollBar;能取得这个div,然后不知道用什么js属性能限制这个滚动条不动
应该是比较基础的问题,大家帮帮忙吧,我对js不是很熟悉

回复讨论(解决方案)

<div style="overflow-y: auto;overflow-x: hidden;height: 210px;vertical-align: top;" id="verticalScrollBar">
Copy after login

<div style="overflow-y: hidden;overflow-x: hidden;height: 210px;vertical-align: top;" id="verticalScrollBar">
Copy after login

bar.onmousewheel = function(e){
    e=e||window.event;
    if (e&&e.preventDefault){ 
        e.preventDefault();
        e.stopPropagation();
    }else{ 
     e.returnvalue=false;  
      return false;     
    }
我加了这个改好了

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template