通过点击角度物体循环

时间:2016-07-09 13:37:15

标签: javascript jquery angularjs

enter image description here我尝试使用jquery通过单击左箭头隐藏前3个产品的不透明度,然后我希望接下来的3个产品淡入视图。我可以通过隐藏不透明度来获得前3个淡出而不移动箭头。因此,当它们不可见时,产品会发生变化,然后我会淡出查看接下来的3个产品。 我似乎无法弄清楚如何在接下来的3张图片中点击前三张图片。任何人都可以帮我这个吗?

HTML

<!DOCTYPE html>
<html ng-app='formApp'>

<head>
    <title>Bicycle App</title>
    <link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
    <link href="app.css" rel="stylesheet">

</head>

<body>
    <div class="header">
        <div class="container">
            <div class='row'>

                <div class='col-md-12'>

                    <i class="fa fa-bicycle" aria-hidden="true"><span>&nbsp;{{"Bike Shop"}}</span></i>
                </div>
            </div>
        </div>
    </div>
    <div class="container">


        <div class="row">

            <div class="col-md-offset-3 col-md-6">
                <!-- end class not needed -->
                <div class="chooseTitle">
                    Choose Your Bicycle
                </div>
            </div>
            </div>
                <!-- you missed md from offset, end class not needed -->
                <div class="products" ng-controller="BikeController">
                  <div class="row">


     <div class="col-md-1" id="leftArrow"><a ng-href="#"><img ng-src="images/leftarrow.png" class="img-responsive"></a></div>
<div class="bikesandtitles">
                  <div id="bikeTitle" class="col-md-3 text-center" ng-repeat="product in products | limitTo:-3">
                  {{product.manufacturer}}
                  <img id="bikePic" ng-src="{{product.image}}">
                  </div>
                       </div>
                   <div class="col-md-1" id="rightArrow"><a ng-href="#"><img ng-src="images/rightarrow.png" class="img-responsive"></a></div>



</div>
                </div><!--End controller-->




    </div>



    <script src="bower_components/angular/angular.js"></script>
    <script src="app.js"></script>
    <script src="bower_components/jquery/dist/jquery.min.js"></script>
    <script src="bikeimageslider.js"></script>
</body>

</html>

bikeimageslider.js

$( document ).ready(function() {

$('#leftArrow').click(function (event) {
  event.preventDefault();

   $('.bikesandtitles').fadeTo(800, 0);
});
});

app.js

var app = angular.module('formApp', []);
app.controller('BikeController',['$scope', function($scope){

$scope.products = [
{
manufacturer: "Trek",
image: 'images/bike1.jpg'
}, 
{
manufacturer: "Mongoose",
image: 'images/bike2.jpg'

},
{   

    manufacturer: "Portlandia",
image: 'images/bike3.jpg'
},
{

    manufacturer: "Giant",
image: 'images/bike4.jpg'
},
{

    manufacturer: "Framed",
image: 'images/bike5.jpg'
},
{
manufacturer: "Windsor",
image: 'images/bike6.jpg'
}
];


this.form = {};
this.addForm = function(product){

};

}]);

0 个答案:

没有答案