Php jQuery jScrollPane未显示(Wordpress)

Php jQuery jScrollPane未显示(Wordpress),php,jquery,wordpress,jscrollpane,Php,Jquery,Wordpress,Jscrollpane,我尝试在我自己的WordPress主题上使用jScrollPane。但事实并非如此。我不知道,问题是什么。。。我只看到旧的灰色标准滚动条 functions.php //Register jScrollPane /////////////////////////////////////////////////////////// add_action( 'wp_enqueue_scripts', 'jscrollpane_libs' ); function jscrollpane_libs

我尝试在我自己的WordPress主题上使用jScrollPane。但事实并非如此。我不知道,问题是什么。。。我只看到旧的灰色标准滚动条

functions.php

//Register jScrollPane
///////////////////////////////////////////////////////////

add_action( 'wp_enqueue_scripts', 'jscrollpane_libs' );  
function jscrollpane_libs()  
{  
    // Register each script, setting appropriate dependencies  
    wp_register_script('jscrollpane', get_template_directory_uri() . '/scroll/jquery.jscrollpane.min.js');
    wp_register_script('mousewheel', get_template_directory_uri() . '/scroll/jquery.mousewheel.js');

    // Register each style, setting appropriate dependencies 
    wp_register_style('jscrollcss',   get_template_directory_uri() . '/scroll/jquery.jscrollpane.css');
}

//Register jQuery 1.8
///////////////////////////////////////////////////////////

wp_deregister_script('jquery');
if(!is_admin()) { 
     wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js');
     wp_enqueue_script('jquery');
}
<script type="text/javascript">
        $(function()
        {
            $('.nivo-caption').jScrollPane();
        });
</script>
header.php

//Register jScrollPane
///////////////////////////////////////////////////////////

add_action( 'wp_enqueue_scripts', 'jscrollpane_libs' );  
function jscrollpane_libs()  
{  
    // Register each script, setting appropriate dependencies  
    wp_register_script('jscrollpane', get_template_directory_uri() . '/scroll/jquery.jscrollpane.min.js');
    wp_register_script('mousewheel', get_template_directory_uri() . '/scroll/jquery.mousewheel.js');

    // Register each style, setting appropriate dependencies 
    wp_register_style('jscrollcss',   get_template_directory_uri() . '/scroll/jquery.jscrollpane.css');
}

//Register jQuery 1.8
///////////////////////////////////////////////////////////

wp_deregister_script('jquery');
if(!is_admin()) { 
     wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js');
     wp_enqueue_script('jquery');
}
<script type="text/javascript">
        $(function()
        {
            $('.nivo-caption').jScrollPane();
        });
</script>

$(函数()
{
$('.nivo caption').jScrollPane();
});
您是否也在标题中呼叫?尝试将functions.php文件中的
wp\u register\u script()
替换为
wp\u enqueue\u script()

更新:现在看来脚本被正确地包含了,也许问题在于标题框中的内容是动态的。一旦内容发生更改,jScrollPane就可以选择内容框。也许您的代码与下面的代码类似

$(function() {
    var pane = $('.nivo-caption');
    pane.jScrollPane();
    var api = pane.data('jsp');
    $('.nivo-control').click(function(){
        api.reinitialise();
    });
}); 
首先

functions.php
中,应该是这样的:

add_action('wp_enqueue_scripts','jscrollpane_libs');
函数jscrollpane_libs()
{
$js=get_template_directory_uri()。/js';
$css=get_template_directory_uri()。/css';
wp_register_脚本('jsp lib',“$js/jquery.jscrollpane.min.js”);
wp_register_脚本('jsp mouse',“$js/jquery.mouseweel.js”);
wp_寄存器_脚本(
“jsp main”,
“$js/demo.js”,

数组('jquery','jsp lib','jsp mouse'),//它在开发工具“控制台”中显示了什么?控制台是空的:(我在我的函数中更改了它。php:
add_action('wp_-enqueue_-scripts','jscrollpane_-libs');函数jscrollpane_-libs(){//注册每个脚本,设置适当的依赖项wp_-enqueue_-script('jscrollpane',get_template_directory_uri()。/scroll/jquery.jscrollpane.min.js');wp_enqueue_脚本('mouseweel',get_template_directory_uri()。/scroll/jquery.mouseweel.js');注册每个样式,设置适当的依赖项wp_enqueue样式('jscrollcs',get_template_directory_uri()。/scroll/jquery.jscrollpane.css'))}
但是我有同样的问题,你能发布链接吗?我是指幻灯片中的第5个标题框感谢你的时间。我将你的代码复制到我的header.php中。但是没有任何更改:/感谢你的时间!:)如果我使用你的代码,我会出现以下错误:加载资源失败:服务器响应状态为404(未找到)[***]/itandgaming/wp content/themes/itandgaming/css/demo.css?ver=3.6.1未捕获引用错误:未定义djQuery此文件存在
http://example.com/itandgaming/wp-content/themes/itandgaming/style.css
,您链接的那个没有。我将demo.js中的“d”删除为“jQuery”(如果是错误输入)现在我只有404错误:加载资源失败:服务器以404(未找到)的状态响应。我不知道你对demo.css的确切意思,我没有demo.css,滚动条仍然不工作:/how to stays only in need“jquery.jscrollpane.css”页面中没有类为
nivo caption
的元素,这不会影响任何内容:
$('.nivo caption').jScrollPane();