jquery - Selecting elements to hide if either first or last in an array -


i'm using slider looping turned off issue running display of navigational arrows first , last slides. having troubling finding way communicate left arrow should hidden on first slide , right arrow last slide.

can target specific slides myswiper.getfirstslide()/myswiper.getlastslide() hide display of respective arrows? or set length of array , designate each arrow hide either if first or last in list?

i'm not sure if these correct approaches. open suggestions.

http://codepen.io/newbcake/pen/sibxi

try this,

$('.arrow-left').hide()   var myswiper = new swiper('.swiper-container',{     loop:false,     onslidechangeend: function () {       $('.arrow-left').show()       $('.arrow-right').show()        if(myswiper.activeindex==0){        $('.arrow-left').hide()        }       if(myswiper.activeindex==myswiper.slides.length-1){       $('.arrow-right').hide()       }     }    })   $('.arrow-left').on('click', function(e){     e.preventdefault()    // alert(myswiper.previousindex)     myswiper.swipeprev()   })   $('.arrow-right').on('click', function(e){     e.preventdefault()     myswiper.swipenext()   }) 

here demo link http://codepen.io/dhana36/pen/lbhzn


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -