【发布时间】:2011-04-24 23:02:39
【问题描述】:
我在一个使用 Wordpress 作为 CMS 的网站上工作,我想在我网站的 div 中使用自定义滚动条。我一直在尝试使用 jScrollPane 插件,但无法让它工作。
主要代码在我的header.php文件中,并且有一个类.scroll-pane header.php中的相关代码是:
<style type="text/css" id="page-css">
.scroll-pane
{
width: 100%;
height: 280px;
overflow: auto;
}
</style>
<script src="<?php bloginfo('template_url'); ?>/js/jquery-1.3.2.min.js"></script>
<link type="text/css" href="<?php bloginfo(template_url); ?>/style/jquery.jscrollpane.css" rel="stylesheet" media="all" />
<script type="text/javascript" src="<?php bloginfo(template_url); ?>/js/jquery.mousewheel.js"></script>
<script type="text/javascript" src="<?php bloginfo(template_url); ?>/js/jquery.jscrollpane.min.js"></script>
<script type="text/javascript">
var $j = jQuery.noConflict();
$j(document).ready(function()
{
$('.scroll-pane').jScrollPane({showArrows: true});
});
</script>
page.php:
< div id="sign-right">
< div class="newsBox-padding">
< div class="scroll-pane newsBox"> WP loop goes here </div></div>
CSS:
.newsBox{height:280px; overflow: auto;}
我收到以下错误(被萤火虫捕获):
" $(".scroll-pane").jScrollPane is not a function
$('.scroll-pane').jScrollPane({showArrows: true}); "
我认为问题出在功能上,因此我尝试了来自各种帖子和论坛的大量建议,包括:
$function(){ jQuery('.scroll-pane').jScrollPane({showArrows: true});
$function(){ $('.scroll-pane').jScrollPane({showArrows: true}); });
我检查了所有对外部文件的引用,并确保类的名称相同,它们似乎都是正确的。我也有一个精通代码的朋友也看过它,但无济于事。
非常感谢您的帮助!
【问题讨论】:
-
我目前遇到了这个问题。找到解决办法了吗?
标签: jquery wordpress jquery-plugins scrollbar jscrollpane