javascript - How to get Jquery scrollTo plugin work with AngularJS - without flickering -


i'm trying combine scrollto plugin jquery angularjs. reason why want want have automated scrolling specific section of website if corresponding url used. until works, not perfectly. there short flickering if 1 clicks on link, before animation starts.

i think problem can solved using:

event.preventdefault(); 

but don't know how combine call of preventdefault function angularjs code ... i'm new angularjs maybe there simple solution don't know yet. tried several solutions found on net without success.

here can find abstract of current solution : http://jsfiddle.net/hcb4b/6/ it's not runnable because can't include easing plugin ...

thanks in advance

the entire source of ngclick super simple https://github.com/angular/angular.js/blob/v1.2.0rc1/src/ng/directive/ngeventdirs.js#l43-l52

effectively:

ng.directive('ngclick',['$parse',function($parse){       return function(scope, element, attr) {         var fn = $parse(attr['ngclick']);         element.on('click', function(event) {           scope.$apply(function() {             fn(scope, {$event:event});           });         });       };    }]); 

so can create own easily:

yourmodule.directive('superclick',['$parse',function($parse){       return function(scope, element, attr) {         var fn = $parse(attr['superclick']);         element.on('click', function(event) {           event.preventdefault(); // magic stuff           scope.$apply(function() {             fn(scope, {$event:event});           });         });       };   }]); 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -