आपकी ऑफलाइन सहायता

BACK
49

सी प्रोग्रामिंग

149

पाइथन प्रोग्रामिंग

49

सी प्लस प्लस

99

जावा प्रोग्रामिंग

149

जावास्क्रिप्ट

49

एंगुलर जे.एस.

69

पी.एच.पी.
माय एस.क्यू.एल.

99

एस.क्यू.एल.

Free

एच.टी.एम.एल.

99

सी.एस.एस.

149

आर प्रोग्रामिंग

39

जे.एस.पी.





डाउनलोड पी.डी.एफ. ई-बुक्स
AJS - Services $anchorScroll

$anchorScroll ये service; $location.hash() function पर दिए गए id के मुताबिक उसके called पर scroll किया जाता है |

$anchorScrollProvider.disableAutoScrolling() को call करने पर $anchorScroll ये service disabled हो जाती है |


Example for $anchorScroll Service in AngularJS

Source Code :
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<style>
.down{
margin-top:2000px;
}
</style>
</head>
<body>

<div ng-app="app" ng-controller="ASctrl">

<a href="" id="top" ng-click="toDown()">Click to go to Down</a>
<div class="down">
<a href="" id="down" ng-click="toTop()">Click to go to Up</a>

</div>
</div>  

<script>
var app = angular.module("app",[]); 
app.controller("ASctrl",['$location','$anchorScroll','$scope', function ($location, $anchorScroll,$scope){  
$scope.toTop = function(){
	$location.hash('top'); 
	$anchorScroll();
}
$scope.toDown = function(){                           
	$location.hash('down'); 
	$anchorScroll();
}                                                                       
}]);
</script>  

</body>
</html>
Output :