HTML - 动态滚动条 [英] HTML - Dynamic Scrollbar

查看:180
本文介绍了HTML - 动态滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在'div'元素中,我将ContentPane的样式定义如下:

 <   div     id   =  rightPane    dojotype   =  dijit.layout.ContentPane    style   =  width:250px; overflow-x:scroll; overflow-y:scroll;    region   =  right >  



但是垂直滚动条(其中overflow-y:scroll或overflow-y:auto)d oes不能按需运行。有2个错误:

1)如果面板中的项目未展开,我希望滚动条处于隐藏状态。但是它总是打开,即使我设置overflow-y:auto。

2)当项目展开时,滚动条仍然表现得像以前一样,并且无法向下滚动。

我需要一个脚本来动态更改滚动条状态。希望你能帮助我完成这段代码。在此先感谢。

解决方案

这是我工作的示例代码,工作正常



< pre lang =xml> < div id = scroll < span class =code-keyword>>
< p > 尝试添加更多文字< / p >
< / div >
这里是css代码

#scroll {
overflow-y:auto;
身高:汽车;
max-height:200px;
边框:1px纯黑色;
宽度:300px;
}


In a 'div' element, I defined the ContentPane's style as below:

<div id="rightPane" dojotype="dijit.layout.ContentPane" style="width: 250px; overflow-x:scroll; overflow-y:scroll;" region="right">


But the vertical scrollbar (where overflow-y:scroll or overflow-y:auto) does not function as needed. There are 2 bugs:
1) If the items in the panel are not expanded, I want to the scrollbar in 'hidden' status. But it is always on even though I set overflow-y:auto.
2) When the items are expanded, the scrollbar still behaves like it before, and can't be scrolled down.
I need a script to dynamically change the scrollbar status. Hopefully you can help me for this piece of code. Thanks in advance.

解决方案

It is a sample code i have worked,It works fine

<div id="scroll">
    <p>Try to add more text</p>
 </div>
here's the css code

#scroll {
   overflow-y:auto;
   height:auto;
   max-height:200px;
   border:1px solid black;
   width:300px;
 }


这篇关于HTML - 动态滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆