开发者

sliderman.js - call "go" function from href

I'm using sliderman.js (http://www.devtrix.net/sliderman/api.html). The last couple hours I tried to figure out how to call a specific slide from an . Test but I always get the message that this function is not defined.

Any help is appreciated.

There seems to be a method called Slider.go which is in the file "sliderman.1.3.0.js

Slider.go = function(index){
            index = (images.length + index) % images.length;
            autoplay(false);
            if(status !开发者_JAVA百科= 'free' || current == index) return autoplay(true) && false;
            previous = current;
            current = index;
            eventCall('loading');
            showLoading(true);
            if(contentmode) doEffect(images[current]);
            else loadImage(images[current], doEffect, display.always_show_loading);
            return true;
        }//go


You were almost there you need to call .go on the variable you use to initialize the slider. For example Demo 3 uses,

var demoSlider_3 = Sliderman.slider({container: 'SliderName_3', width: 800, height: 200, effects: effectsDemo3, display: {autoplay: 3000}});

So to get it to work on a link for example you can do the following.

<a href="#" onclick="demoSlider_3.go(1)">go</a>

the number 1 is the id of the slide. I went ahead and tested it locally and it worked every time. You can try it by downloading Demo 3, and adding the link anywhere on the page.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜