开发者

Customise JQuery EasySlider plugin numeric output menu to use text string instead?

I'm using this plugin: http://cssglobe.com/post/5780/easy-slider-17-numeric-navigation-jquery-slider

Demo: http://cssglobe.com/lab/开发者_如何学JAVAeasyslider1.7/02.html

Maybe somewhere in here can be altered?

if(options.numeric){                                    
            for(var i=0;i<s;i++){                       
                $(document.createElement("li"))
                    .attr('id',options.numericId + (i+1))
                    .html('<a rel='+ i +' href=\"javascript:void(0);\">'+ (i+1) +'</a>')
                    .appendTo($("#"+ options.numericId))
                    .click(function(){                          
                        animate($("a",$(this)).attr('rel'),true);
                    });         

And I was wondering if anyone could tell me how to switch from the auto-generated numbers in the numeric option to a text string of my own? Currently it automatically generates the links for the slider in a list using the slide number as the link text.

I don't know javascript, if that's not obvious... :P

Any tips extremely appreciated!


Looks like here:

if(options.numeric){
    for(var i=0;i<s;i++){
        $(document.createElement("li"))
            .attr('id',options.numericId + (i+1))
            // THIS LINE:
            .html('<a rel='+ i +' href=\"javascript:void(0);\">'+ (i+1) +'</a>')
            .appendTo($("#"+ options.numericId))
            .click(function(){
                animate($("a",$(this)).attr('rel'),true);
             });
    };
} else { ...

The (i+1) is the number that shows up. If you make an array with the names of your slide, you can replace this with slideName[i]:

var slideName = new Array('foo', 'bar', 'etc');

if(options.numeric){
    for(var i=0;i<s;i++){
        $(document.createElement("li"))
            .attr('id',options.numericId + (i+1))
            // THIS LINE:
            .html('<a rel='+ i +' href=\"javascript:void(0);\">'+ slideName[i] +'</a>')
            .appendTo($("#"+ options.numericId))
            .click(function(){
                animate($("a",$(this)).attr('rel'),true);
             });
    };
} else { ...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜