1

我正在为客户端将静态 HTML 站点转换为 Wordpress,但在让 Nivo 滑块工作时遇到问题。

它在 HTML 版本上完美运行,可以在这里看到,在 Wordpress 版本上,它似乎没有显示任何图像。

Wordpress 版本的脚本正在注册,因为它将一些样式应用于 .slider 元素,但幻灯片图像始终设置为 display:none。

有人有什么想法吗?

编辑;

HTML 版本使用这个;

$(window).load(function() {
$('.slider').nivoSlider({
    effect:'fade', //Specify sets like: 'fold,fade,sliceDown'
    slices:40,
    directionNav:false, //Next and Prev
    controlNav:false //1,2,3...

});

并且 WP 版本使用这个;

jQuery(document).ready(function ($) {

    $('.slider').nivoSlider({
        effect:'fade', //Specify sets like: 'fold,fade,sliceDown'
        slices:40,
        directionNav:false, //Next and Prev
        controlNav:false //1,2,3...

    });

});
4

1 回答 1

0

您缺少静态版本中的 jquery.min.js 文件。确保添加下面的行

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>

如果将上面的行插入到您的页脚中,则添加上面的行似乎只能解决问题:

<script type='text/javascript' src='http://www.terrafirma4x4.com/tfplugin/tfplugin-latest-jquery.js?ver=3.5.1'></script>
于 2013-04-22T22:06:41.667 回答