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

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -