angularjs - scroll to next item in ng-repeat -


with example below using angular.element, how scroll next item in ng-repeat on every click?

this have far, don't know next:

var app = angular.module('myapp', []);  app.controller('maincontroller', ['$scope', function ($scope) {     $scope.items = [{       name: "apple"    }, {       name: "pear"    }, {       name: "avacado"    }, {       name: "banana"    }];     $scope.go = function ($event) {       console.log(angular.element($event.currenttarget).parent().next());    };  }]); 

html:

<div ng-app="myapp">   <div ng-controller="maincontroller">     <div class="box" ng-repeat="item in items track $index">          <h3>{{item.name}}</h3>         <button ng-click="go($event)">go next box</button>     </div>   </div> </div> 

http://jsfiddle.net/0bwclfv4/2/

jquery included on site already, want animation every scroll.

now sure how fancy trying get. can basic html anchor tags.

<a name="section1">section 1</a> 

alongside

<a href="#section1">go section 1</a> 

Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -