javascript - Making a simple slider -
how can make slider, 1 multiple photos through can navigate arrows?
i have images , arrows in page. should hide images , when arrow clicked hide current image , display next/prev?
i have images in list.
i think should go it. make own, it's best way learn how things work. here's guide simple show/hide box arrows:
- hide images css.
- show image class
current
. - use jquery on load function add
current
class first element (you can handle preload or here) - on arrow click assign current image variable
var current = $('.imgclass.current')
, removecurrent
class images ($('.imgclass').removeclass('current')
), , addcurrent.next()
or.prev()
. ifnext()
orprev()
undefined, add element number0
or$('.imgclass').length - 1
accordingly ($('.imgclass').eq(n).addclass('current')
).
Comments
Post a Comment