<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
<div ng-app="Scroll">
Drag for scroll please
<div class="container" ng-controller="ScrollCtrl">
<div id="content">
<div ng-repeat="item in list">
Item: {{item}}
</div>
</div>
</div>
<div>
<h1>
Testing Heading
</h1>
<p>
This is the drag for scroll and load dynamic data on drag of the page. This is the drag for scroll and load dynamic data on drag of the page.This is the drag for scroll and load dynamic data on drag of the page.This is the drag for scroll and load dynamic data on drag of the page.This is the drag for scroll and load dynamic data on drag of the page.This is the drag for scroll and load dynamic data on drag of the page.This is the drag for scroll and load dynamic data on drag of the page.This is the drag for scroll and load dynamic data on drag of the page.This is the drag for scroll and load dynamic data on drag of the page.This is the drag for scroll and load dynamic data on drag of the page.This is the drag for scroll and load dynamic data on drag of the page.This is the drag for scroll and load dynamic data on drag of the page.This is the drag for scroll and load dynamic data on drag of the page.This is the drag for scroll and load dynamic data on drag of the page.This is the drag for scroll and load dynamic data on drag of the page.This is the drag for scroll and load dynamic data on drag of the page.This is the drag for scroll and load dynamic data on drag of the page.This is the drag for scroll and load dynamic data on drag of the page.This is the drag for scroll and load dynamic data on drag of the page.This is the drag for scroll and load dynamic data on drag of the page.This is the drag for scroll and load dynamic data on drag of the...
var containerHeight = 200;
var loadMargin = 10;
var i;
angular.module('Scroll', []).controller('ScrollCtrl', function($scope) {
$("#content").draggable({
axis: 'y',
drag: function(evt, ui) {
var minTop = containerHeight - $("#content").height();
if (ui.position.top < minTop + loadMargin) {
//Load some more stuff here... $http anyone?
$scope.list.push(i);
i += 1;
console.log('Loading!!!');
//If you load ur stuff with $http or an Angular service
//in principle you wont need this $digest
$scope.$digest();
}
}
});
$scope.list = [];
for (i = 0; i < 20; i ++) {
$scope.list.push(i);
}
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.