WordPress

如何使Nivo Slider支持Cufon

Nivo Slider最新版(v2.7.1)支持Cufon的方法如下。

打开jquery.nivo.slider.js,找到如下代码,(line99-line118)

// Process caption function
var processCaption = function(settings){
    var nivoCaption = $('.nivo-caption', slider);
    if(vars.currentImage.attr('title') != '' && vars.currentImage.attr('title') != undefined){
        var title = vars.currentImage.attr('title');
        if(title.substr(0,1) == '#') title = $(title).html();	
 
        if(nivoCaption.css('opacity') != 0){
            nivoCaption.find('p').stop().fadeTo(settings.animSpeed, 0, function(){
                $(this).html(title);
                $(this).stop().fadeTo(settings.animSpeed, 1);
            });
        } else {
            nivoCaption.find('p').html(title);
        }
        nivoCaption.stop().fadeTo(settings.animSpeed, settings.captionOpacity);
    } else {
        nivoCaption.stop().fadeTo(settings.animSpeed, 0);
    }
}

替换成如下代码

Read More