开发者

Coda-Slider Previous and Next Button Hiding

开发者 https://www.devze.com 2022-12-09 20:43 出处:网络
Pretty simple question, I know it\'s just a matter of if / else if statements but I\'m unable to get them to run correctly.

Pretty simple question, I know it's just a matter of if / else if statements but I'm unable to get them to run correctly.

I'm using the basis of http://jqueryfordesigners.com/coda-slider-effect/, I can get them hidden, etc, but when it comes to having them available depending on the situation (what is currently selected) I'm just unable to get it to work correctly.

There's a serialscroll plugin for it, but, it doesn't seem to be working for coda-slider.

jQuery(function( $ ){
var $prev = $('#before'),//prev button
    $next开发者_如何学运维 = $('#after');//next button

$('.slider').serialScroll({
    //...
    cycle:false, //you probably don't want this
    onBefore:function( e, elem, $pane, $items, pos ){
        $prev.add($next).show();
        if( pos == 0 )
            $prev.hide();
        else if( pos == $items.length-5 )
            $next.hide();
    }
    //...
});

});

So, I'm not sure if I'm missing something on the serialscroll side, or should just write a simple situational piece of JS for it, which I'm having trouble doing!

I have used and have set cycle: false as you can see, and while it will stop scrolling and make the buttons do nothing, they will not dissapear

Thanks in advance!


is your onBefore function is being called

0

精彩评论

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

关注公众号