jQuery ScrollPane 只是由于某种原因无法工作
我已经逐行复制了演示行,对我来说发生的情况是内容加载,然后滚动条消失了。
我知道正在调用并应用 jScrollPane 函数,因为加载内容时滚动条会消失,但我一生都无法弄清楚为什么......
有人对这个插件有任何经验吗?
<!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" xml:lang="en" lang="en">
<head>
<title>Test</title>
<link type="text/css" href="/_assets/js/jquery.jscrollpane.css" rel="stylesheet" media="all" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="/_assets/js/jquery.jscrollpane.min.js"></script>
</head>
<body>
<script type="text/javascript">
$(function()
{
$('.scroll-pane').jScrollPane();
});
</script>
<div id="container">
<div id="content">
<div class="scroll-pane" style="width:100%;height:100px;overflow:auto;">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus aliquet, sapien eget tincidunt fermentum, urna justo rutrum tortor, molestie pharetra dolor leo non velit. Donec sem magna, cursus congue feugiat iaculis, viverra eget sapien. Cras fringilla adipiscing pharetra. Sed semper nisi nec purus vulputate at iaculis enim venenatis. Pellentesque adipiscing, erat laoreet euismod semper, metus magna rutrum orci, nec convallis leo dolor vitae sem. Nunc malesuada consequat blandit. Sed sed urna sed arcu porttitor semper sed molestie dui. Sed sed dolor nibh. Aenean a metus est. Maecenas quam felis fringilla nec rhoncus vel, interdum eu mauris. Nulla sapien tellus, condimentum nec blandit sed, laoreet ac dui. Vestibulum vitae odio eget libero facilisis venenatis et eget justo. Aliquam velit ligula, cursus sed imperdiet vel, convallis ac urna. Maecenas quis eros ante. Pellentesque blandit enim suscipit purus vestibulum tempor vulputate leo sollicitudin. Nunc viverra lacus vel urna scelerisque sed tempor tortor congue. Suspendisse aliquam aliquam convallis. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
<br /><br />
Vivamus sit amet sapien lacus. Aliquam id augue eget neque dictum ultricies vitae sit amet lacus. Sed tempus pulvinar ullamcorper. Nunc fringilla tincidunt justo vel imperdiet. Morbi aliquam eleifend aliquet. Sed id sagittis purus. Morbi sem dui, feugiat a posuere non, tincidunt sit amet dolor. Nullam tristique dolor ut dui convallis id egestas eros tincidunt. Mauris a orci sit amet nisi viverra convallis quis quis mi. In id ligula quis justo facilisis pellentesque eu in metus.
</div>
</body>
</html>
I've copied the demo line for line and what happens for me is that the content loads and then the scroll bar just disappears.
I know the jScrollPane function is being called and applied because the scroll bar disappears when the content loads but for the life of me I can't figure out why...
Anyone have any experience with this plug-in?
<!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" xml:lang="en" lang="en">
<head>
<title>Test</title>
<link type="text/css" href="/_assets/js/jquery.jscrollpane.css" rel="stylesheet" media="all" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="/_assets/js/jquery.jscrollpane.min.js"></script>
</head>
<body>
<script type="text/javascript">
$(function()
{
$('.scroll-pane').jScrollPane();
});
</script>
<div id="container">
<div id="content">
<div class="scroll-pane" style="width:100%;height:100px;overflow:auto;">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus aliquet, sapien eget tincidunt fermentum, urna justo rutrum tortor, molestie pharetra dolor leo non velit. Donec sem magna, cursus congue feugiat iaculis, viverra eget sapien. Cras fringilla adipiscing pharetra. Sed semper nisi nec purus vulputate at iaculis enim venenatis. Pellentesque adipiscing, erat laoreet euismod semper, metus magna rutrum orci, nec convallis leo dolor vitae sem. Nunc malesuada consequat blandit. Sed sed urna sed arcu porttitor semper sed molestie dui. Sed sed dolor nibh. Aenean a metus est. Maecenas quam felis fringilla nec rhoncus vel, interdum eu mauris. Nulla sapien tellus, condimentum nec blandit sed, laoreet ac dui. Vestibulum vitae odio eget libero facilisis venenatis et eget justo. Aliquam velit ligula, cursus sed imperdiet vel, convallis ac urna. Maecenas quis eros ante. Pellentesque blandit enim suscipit purus vestibulum tempor vulputate leo sollicitudin. Nunc viverra lacus vel urna scelerisque sed tempor tortor congue. Suspendisse aliquam aliquam convallis. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
<br /><br />
Vivamus sit amet sapien lacus. Aliquam id augue eget neque dictum ultricies vitae sit amet lacus. Sed tempus pulvinar ullamcorper. Nunc fringilla tincidunt justo vel imperdiet. Morbi aliquam eleifend aliquet. Sed id sagittis purus. Morbi sem dui, feugiat a posuere non, tincidunt sit amet dolor. Nullam tristique dolor ut dui convallis id egestas eros tincidunt. Mauris a orci sit amet nisi viverra convallis quis quis mi. In id ligula quis justo facilisis pellentesque eu in metus.
</div>
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在此处重新创建了您的代码,当我添加 CSS 链接时它开始工作。您代码中的 CSS 链接托管在您的服务器上,因此我无法亲眼看到,但我会检查该文件在该 url 上是否可用并且是正确的文件。
我从 jScrollPane 版本 1 获得了 CSS 链接,以防万一。
您还缺少一个结束 /div 的价值。
编辑:这就是我要链接到上面的内容。对于造成的任何混乱,我们深表歉意。
I've recreated your code here and it started working when I added the CSS link. The CSS link in your code is hosted on your server so I can't see for myself, but I would check that the file is available at that url and that it is the correct file.
I got the CSS link from version 1 of jScrollPane, in case that matters.
You're also missing a closing /div for what it's worth.
Edit: This is what I meant to link to above. Sorry for any confusion caused.