我可以使用Angular JS在Carousel中移动图像。但问题是,它一次移动三个图像,我只想移动一个图像,以便插入一个新图像。页面应该有三个图像,但只应移动一个图像,并插入下一个图像。请找到代码
$scope.displayMode = "tablet";
//##################################################
if ($scope.displayMode == "mobile") {many = 1;}
else if ($scope.displayMode == "tablet") {many = 2;}
else {many = 3;}
for (i = 0; i < $scope.slides.length; i += many) {
second = {
image1: $scope.slides[i]
};
if (many == 1) {}
if ($scope.slides[i + 1] && (many == 2 || many == 3)) {
second.image2 = $scope.slides[i + 1];
}
if ($scope.slides[i + (many - 1)] && many == 3) {
second.image3 = $scope.slides[i + 2];
}
first.push(second);
}
console.log(first);
Plunker代码为http://plnkr.co/edit/umswXrj8AgpK7T2dP9Pk?p=preview