jScrollPane 未显示在 DIV 中
首先,我已经搜索了一段时间,但找不到对我有用的答案。
我正在为客户开发一个网站。我正在使用 jScrollPane jQuery 插件,但它没有显示。我一开始担心也许其他一些 jQuery 插件会影响它,但是当我将 .scroll-pane 类应用到某些东西时,它会拉伸 div 的高度以显示没有滚动条的所有内容。我不知道,可能还是有关系,我也说不出来。我无法显示该网站,因为我与所有客户签署了保密协议,但我可以显示相关代码。
这些是我的标题中的脚本链接:
<link rel="stylesheet" href="css/global.css" type="text/css" media="screen" />
<link rel="stylesheet" type="text/css" media="all" href="css/jScrollPane.css" />
<link rel="shortcut icon" href="favicon.ico" />
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/supersized.3.1.3.min.js"></script>
<script type="text/javascript" src="js/jquery.mousewheel.js"></script>
<script type="text/javascript" src="js/jScrollPane.js"></script>
这是带有嵌套 DIV 的相关 HTML:
<!--INFO TAB-->
<div id="infocontainer">
<div id="infobox">
</div>
<div id="infomenu">
</div>
<div id="inforule">
</div>
<div id="infocontent" class="scroll-pane">
TEXTTEXTT EXTTEXTTEXTTEXT TEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEX TTEXTTEXTT EXTTEXTTEXTT EXTTEXT TEXTTEXTTEXTTEXTT EXTTEXTT EXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEX TTEXTTEXTTEX TTEXTTEXTTEXTTEXTTEXTTEXTTE XTTE XTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEX TTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT
</div>
</div>
这是在正文结束之前调用函数的脚本:
<script>
$(function()
{
$('.scroll-pane').jScrollPane();
});
</script>
相关 CSS:
#infocontainer {
position:absolute;
top:30px;
left:350px;
height:385px;
width:625px;
z-index:1;
}
#infobox {
background-color:#f4f4f4;
position:absolute;
height:100%;
width:100%;
z-index:-1;
}
#infomenu {
padding-top:44px;
padding-left:49px;
text-align:left;
z-index:1;
}
#inforule {
margin-left:239px;
margin-top:-175px;
z-index:5;
}
#infocontent {
line-height:18px;
margin-left:290px;
margin-top:-287px;
height:284px;
overflow:auto;
width:270px;
text-align:left;
z-index:1;
}
DIV 不透明度最初为 0,然后是一些自定义 javascript 我write 在页面加载时使它们达到 100%。我还使用 Supersize jQuery 来设置全屏适合的背景图像。
我不知道为什么它不起作用,我尝试关闭所有其他 javascript 和 jQuery 使用,仅打开 jScrollPane,但它仍然无法正常工作。任何帮助将不胜感激。
Firstly, I've searched for a while and couldn't find an answer that has worked for me.
I'm developing a website for a client. I am using jScrollPane jQuery plugin but it's not showing. I was at first concerned that maybe some other jQuery Plugins were effecting it, but when I apply the .scroll-pane class to something it stretches the height of the div to show all the content without scrollbars. I don't know, it may still have something to do with it, I can't tell. I can't show the site as I sign non-disclosure agreements with all my clients, but I can show the relevant code.
These are the script links in my header:
<link rel="stylesheet" href="css/global.css" type="text/css" media="screen" />
<link rel="stylesheet" type="text/css" media="all" href="css/jScrollPane.css" />
<link rel="shortcut icon" href="favicon.ico" />
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/supersized.3.1.3.min.js"></script>
<script type="text/javascript" src="js/jquery.mousewheel.js"></script>
<script type="text/javascript" src="js/jScrollPane.js"></script>
This is the relevant HTML with the nested DIVs:
<!--INFO TAB-->
<div id="infocontainer">
<div id="infobox">
</div>
<div id="infomenu">
</div>
<div id="inforule">
</div>
<div id="infocontent" class="scroll-pane">
TEXTTEXTT EXTTEXTTEXTTEXT TEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEX TTEXTTEXTT EXTTEXTTEXTT EXTTEXT TEXTTEXTTEXTTEXTT EXTTEXTT EXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEX TTEXTTEXTTEX TTEXTTEXTTEXTTEXTTEXTTEXTTE XTTE XTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEX TTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT
</div>
</div>
This is the script that calls the function just before the end of the body:
<script>
$(function()
{
$('.scroll-pane').jScrollPane();
});
</script>
Relevant CSS:
#infocontainer {
position:absolute;
top:30px;
left:350px;
height:385px;
width:625px;
z-index:1;
}
#infobox {
background-color:#f4f4f4;
position:absolute;
height:100%;
width:100%;
z-index:-1;
}
#infomenu {
padding-top:44px;
padding-left:49px;
text-align:left;
z-index:1;
}
#inforule {
margin-left:239px;
margin-top:-175px;
z-index:5;
}
#infocontent {
line-height:18px;
margin-left:290px;
margin-top:-287px;
height:284px;
overflow:auto;
width:270px;
text-align:left;
z-index:1;
}
The DIVs opacity is initially 0 and then some custom javascript I wrote brings them to 100% when the page loads. I am also using the Supersize jQuery that sets up full screen fit background images.
I have no idea why it's no working, I've tried turning all other javascript and jQuery use off with only the jScrollPane on and it still does't work any better or worse. Any help would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为了获得乐趣,请尝试将 jquery 恢复到以前的版本,例如 1.5.2。看看这个:code.google.com/p/jscrollpane/issues/detail?id=207#c2 – julie p
for kicks, try to revert your jquery to a previous version, like 1.5.2. check this out: code.google.com/p/jscrollpane/issues/detail?id=207#c2 – julie p
将 Div 的内容括在
标签内,例如
Enclose the content of the Div inside the
tag like