jScrollPane滚动条问题

2024-04-25

我正在开发一个使用 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> 

页面.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}); });

我已经检查了对外部文件的所有引用,并确保类的名称相同,它们似乎都是正确的。我也有一个精通代码的朋友看过它,但无济于事。

我真的很感谢你的帮助!


也许我在这里遗漏了一些东西,从未使用过 jscrollpane,但我没有看到你包括 jquery 本身。此外,您还可以调用 noconflict ,然后仍然在函数中使用 $ 。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

jScrollPane滚动条问题 的相关文章

随机推荐