1

I'm using AnythingSlider, http://proloser.github.com/AnythingSlider/, and have created a page which contains 2 sliders.

Is it possible to control both these sliders with the prev/next arrows of only one of them? i.e you click the 'prev' arrow of slider1 and slider2 also moves to the previous slide.

I have this working using a function in the onSlideBegin callback, and passing the targetPage to the other slider ($slider):

$imgSlider = $('#imgSlider').anythingSlider({
    onSlideBegin: function(e, slider) {
        $slider.anythingSlider(slider.targetPage);
    }
});

The problem is when moving from the first slide to the last (or last to first). The slider that the arrows belong to behaves as desired (the slider is infinite, so moving from first to last uses the cloned slides). But the other slider rewinds through all slides.

Is there a way to prevent this?

4

1 に答える 1

0

AnythingSlider に特定のページに移動するように指示すると、そのページに直接移動し、複製されたスライドをスライドしません。このデモは、両方のスライダーを制御する 1 つの矢印セットを含むホーム Wikiページからのものです。

$('#slider1, #slider2').anythingSlider({

    // If true, builds the forwards and backwards buttons
    buildArrows: false

});

$('#fwd, #bck').click(function(){
    var direction = (this.id === 'fwd') ? 'goForward' : 'goBack';
    $('ul[id^=slider]').each(function(){
        $(this).data('AnythingSlider')[direction]();
    });
});​
于 2012-08-04T18:07:16.157 に答える