任何人都有幸获得JScrollPane与JQuery合作?
我按照信中的说明操作,所有发生的事情是,当页面加载时,调用只是隐藏浏览器的滚动条,但不会呈现自定义滚动条。
测试HTML页面中包含的文件:
http://70.85.188.226/_assets/css/jscrollpane.css
http://70.85.188.226/_assets/js/jquery-1.2.3.min.js
http://70.85.188.226/_assets/js/jscrollpane.js
HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<link rel="stylesheet" type="text/css" href="/_assets/css/jscrollpane.css" media="screen,projection,print" />
<script type="text/javascript" src="/_assets/js/jquery-1.2.3.min.js"></script>
<script type="text/javascript" src="/_assets/js/jscrollpane.js"></script>
<style type="text/css">
#test
{
width:400px;
height:300px;
overflow:auto;
background-color:#2b2b2b;
color:#ffffff;
}
</style>
<script type="text/javascript">
$(function()
{
$('#test').jScrollPane();
});
</script>
</head>
<body>
<div id="test">
<div style="height:36px;">TEST</div>
<div style="clear:both;"></div>
<div style="height:36px;">TEST</div>
<div style="clear:both;"></div>
<div style="height:36px;">TEST</div>
<div style="clear:both;"></div>
<div style="height:36px;">TEST</div>
<div style="clear:both;"></div>
<div style="height:36px;">TEST</div>
<div style="clear:both;"></div>
<div style="height:36px;">TEST</div>
<div style="clear:both;"></div>
<div style="height:36px;">TEST</div>
<div style="clear:both;"></div>
<div style="height:36px;">TEST</div>
<div style="clear:both;"></div>
<div style="height:36px;">TEST</div>
<div style="clear:both;"></div>
<div style="height:36px;">TEST</div>
<div style="clear:both;"></div>
<div style="height:36px;">TEST</div>
<div style="clear:both;"></div>
<div style="height:36px;">TEST12</div>
<div style="clear:both;"></div>
</div>
</body>
</html>
答案 0 :(得分:0)
检查jScrollPane JavaScript文件的第50行。
if (percentInView < .99) {
这导致我出了问题,
我console.log()
'它的价值,它总是返回.99,因此它永远不会添加滚动元素。我预测这可能与我的CSS设置方式有关。我建议你看看你的CSS。
答案 1 :(得分:0)
可能是因为您缺少测试div所需的类声明。
要应用jScrollPane,您必须将测试div的类设置为“滚动窗格”。