JS: Using angular to achieve gallery effect

Source: Internet
Author: User

<! DOCTYPE html>Type:none;}        . bb{transition:all 1s; }    </style>/*Determine whether this style is used by comparing this parameter*/--<ul ng-style= "ULS" style= "width:2160px;position:relative; overflow:hidden; padding:0px; margin:0px ;"ng-class=" {Bb:1==see} > <!--loop traversal lis--> <li ng-style= "AA" style= "float:left;        width:540px; "ng-repeat=" Item in LIS ">  </li> </ul> </div></body><script language= "JavaScript" >varApp = Angular.module ("myApp", []); App.controller ("Myctrl",function($scope) {$scope. Lis= [            {"img": ". /image/slide1.jpg "},            {"img": ". /image/slide2.jpg "},            {"img": ". /image/slide3.jpg "}] $scope. ULS= {"Left": "0px"}; varIndex=0; $scope. See=1; varLl=0; SetInterval (function() {$scope. $apply (function(){//If you modify the data in SetInterval or other JS-like methods, you need to manually update it via apply.                     varlv=parseint ($scope. Uls.left); if(index==2){                        if(ll==2) {$scope. Lis= [                            {"img": ". /image/slide3.jpg "},                            {"img": ". /image/slide1.jpg "},                            {"img": ". /image/slide2.jpg "}                        ]                        }Else if(ll==4) {$scope. Lis= [                                {"img": ". /image/slide2.jpg "},                                {"img": ". /image/slide3.jpg "},                                {"img": ". /image/slide1.jpg "}                            ]                        }Else if(ll==6) {$scope. Lis= [                                {"img": ". /image/slide1.jpg "},                                {"img": ". /image/slide2.jpg "},                                {"img": ". /image/slide3.jpg "}] ll=0;                        } console.log (LL); $scope. See=0; Index=0; LV=0; }Else{$scope. see=1;lv-=540;index++;ll++;} $scope. Uls.left= lv+ "px"; })            },1500); });</script>

JS: Using angular to achieve gallery effect

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.