I'm creating a simple slider for angularJS and I just want to limit the scrolling of the items when you click the next and prev. I don't know how to proceed and I need some help here.
What i've done so far.
Javascript/AngularJS/CSS3 codes only. No plugin, library or jQuery please. Thanks in advance.
Made an edit here: http://jsbin.com/liqomeya/4/edit
slideAmount
to default as 0
(the other setting caused an unnecessary click to start progressing the slides) slideCurrent
variable - defaulted as 0
(this keeps track of which slide you're on) if (slideCurrent == 0) { return }
to the $scope.prev
function (this prevents you from going past the first slide) if (slideCurrent == $scope.projects.length - 1) { return }
to the $scope.next
function (this prevents you from going past the last slide) slideCurrent--
to $scope.prev
and slideCurrent++
to $scope.next
(in order to increment/decrement the slide) slideAmount
updates to 160
instead of 200
(each slide is 160px so this makes it line up properly)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.