<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js"></script>
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
overflow: auto; /* or overflow-x: scroll; */
white-space: nowrap; /* Ensures the content stays in a single line */
<div ng-app="myApp" ng-controller="myController" class="container">
<h3>AngularJS Get Element Scroll Position</h3>
<div id="myElement" ng-init="trackElementScrollPosition('myElement')">
Font Awesome is a popular icon set used by designers and developers
worldwide. It was created by Dave Gandy in 2012 and has since become
one of the most widely used icon sets on the web.
Font Awesome icons are vector-based, which means they can be scaled to
any size without losing their quality or becoming pixelated.
Font Awesome is a popular icon set used by designers and developers
worldwide. It was created by Dave Gandy in 2012 and has since become
one of the most widely used icon sets on the web.
Font Awesome icons are vector-based, which means they can be scaled to
any size without losing their quality or becoming pixelated.
Font Awesome is a popular icon set used by designers and developers
worldwide. It was created by Dave Gandy in 2012 and has since become
one of the most widely used icon sets on the web.
Font Awesome icons are vector-based, which means they can be scaled to
any size without losing their quality or becoming pixelated.
Font Awesome is a popular icon set used by designers and developers
worldwide. It was created by Dave Gandy in 2012 and has since become
one of the most widely used icon sets on the web.
Font Awesome icons are vector-based, which means they can be scaled to
any size without losing their quality or becoming pixelated.
<p>Scroll Top: {{ positionTop }}px</p>
<p>Scroll left: {{ positionLeft }}px</p>
angular.module("myApp", []).controller("myController", function ($scope) {
$scope.trackElementScrollPosition = function (elementId) {
var element = angular.element(document.getElementById(elementId));
element.on("scroll", function () {
$scope.$apply(function () {
$scope.positionTop = element[0].scrollTop;
$scope.positionLeft = element[0].scrollLeft;