Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/459.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Nivo滑块-将项目符号文本1,2,3替换为文字_Javascript - Fatal编程技术网

Javascript Nivo滑块-将项目符号文本1,2,3替换为文字

Javascript Nivo滑块-将项目符号文本1,2,3替换为文字,javascript,Javascript,我在我的网站上使用Nivo滑块,想知道是否可以通过更改javascript/添加一些css将编号的项目符号(即1,2,3)更改为单词 我认为这与代码的这一部分有关 // Add Control nav if(settings.controlNav){ vars.controlNavEl = $('<div class="nivo-controlNav"></div>'); slider.after(vars.controlNavEl

我在我的网站上使用Nivo滑块,想知道是否可以通过更改javascript/添加一些css将编号的项目符号(即1,2,3)更改为单词

我认为这与代码的这一部分有关

// Add Control nav
    if(settings.controlNav){
        vars.controlNavEl = $('<div class="nivo-controlNav"></div>');
        slider.after(vars.controlNavEl);
        for(var i = 0; i < kids.length; i++){
            if(settings.controlNavThumbs){
                vars.controlNavEl.addClass('nivo-thumbs-enabled');
                var child = kids.eq(i);
                if(!child.is('img')){
                    child = child.find('img:first');
                }
                if(child.attr('data-thumb')) vars.controlNavEl.append('<a class="nivo-control" rel="'+ i +'"><img src="'+ child.attr('data-thumb') +'" alt="" /></a>');
            } else {
                vars.controlNavEl.append('<a class="nivo-control" rel="'+ i +'">'+ (i + 1) +'</a>');
            }
        }
//添加控制导航
if(设置.控制导航){
变量controlNavEl=$('');
滑块后(变量控制脐);
for(var i=0;i
如果我能拥有这些单词并使用css设计它们的样式,那就太好了

我用controlNav作为按钮而不是子弹

如果你需要更多信息,请告诉我


谢谢-真的希望有人能在这方面帮助我!

我不熟悉Nivo滑块,但据我所知,文本是在您的最后一行代码中创建的:

vars.controlNavEl.append('<a class="nivo-control" rel="'+ i +'">'+ (i + 1) +'</a>');


唯一的问题(可能)是,交换机可能是一个长列表,取决于有多少个弹头。

可以考虑使用CSS选择器以其Read属性为锚定目标(对于这些锚,似乎是基于数字的索引)。请参阅关于这个主题的细节。

使用纯CSS实现这一点的示例如下:

a.nivo-control[rel='1'] { content: 'One!'; }
当然,要想让它起作用,你需要事先知道你大概有多少张幻灯片

如果您喜欢jQuery(因为它是使用Nivo的先决条件,所以您已经有了jQuery),您可以执行以下操作:

jQuery("a.nivo-control[rel='1']").html("One!");

(编辑:这里的基本原理是,您不必更改Nivo Slider的基本代码,您可以在事后进行修改;因此,当您将来更新插件时,您的更改有望立即生效。)

谢谢,或者您的时间。效果很好。非常感谢。
a.nivo-control[rel='1'] { content: 'One!'; }
jQuery("a.nivo-control[rel='1']").html("One!");