I have page with two buttons (scroll left and scroll right), and on click, page have to go left and right by div width (every div have different width). Could this be done with jQuery? I don’t know how to read current div id (one close to left side of border), and how to define scroll (left or right) by width of previous/next div?
Share
On click just increase, decrease a Counter
var c.This will help us to target the desired DIV by
.eq( c )Than all we need is to get the desired DIV
.offset().leftand move the page to that position:jsBin demo
HTML (add a .box to your DIVs):
jQuery: