<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ngInfiniteScroll/1.3.0/ng-infinite-scroll.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<body>
<div ng-app='myApp' ng-controller='DemoController'>
<div class="container">
<br/><br/>
<button ng-click="showGreen = !showGreen" class="col-xs-6">
<span ng-show="showGreen">Hide</span>
<span ng-show="!showGreen">Show</span>
Green
</button>
<button ng-click="showBlue = !showBlue" class="col-xs-6">
<span ng-show="showBlue">Hide</span>
<span ng-show="!showBlue">Show</span>
Blue
</button>
<div class="row">
<div ng-show="showGreen" class="greenContainer col-xs-6">
<div infinite-scroll='loadMoreGreen()'
infinite-scroll-distance='2'
infinite-scroll-disabled="!showGreen"
infinite-scroll-container="'.greenContainer'"
infinite-scroll-immediate-check="false"
>
<img ng-repeat='greenImg in greenImages' ng-src='http://placehold.it/125x150/00ff00/&text={{greenImg}}'>
</div>
</div>
<div ng-show="showBlue" class="col-xs-6">
<div class="blueContainer">
<div infinite-scroll='loadMoreBlue()'
infinite-scroll-distance='2'
infinite-scroll-disabled="!showBlue"
infinite-scroll-container="'.blueContainer'"
infinite-scroll-immediate-check="false"
>
<img ng-repeat='blueImg in blueImages' ng-src='http://placehold.it/125x150/0000ff/&text={{blueImg}}'>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
.greenContainer, .blueContainer {
overflow: scroll;
height: 500px;
}
img {
padding: 2px;
}
var myApp = angular.module('myApp', ['infinite-scroll']);
myApp.controller('DemoController', function($scope) {
$scope.greenImages = [1, 2, 3, 4, 5, 6, 7, 8];
$scope.loadMoreGreen = function() {
console.log('loadMoreGreen()');
var last = $scope.greenImages[$scope.greenImages.length - 1];
for(var i = 1; i <= 8; i++) {
$scope.greenImages.push(last + i);
}
};
// --- //
$scope.blueImages = [1, 2, 3, 4, 5, 6, 7, 8];
$scope.loadMoreBlue = function() {
console.log('loadMoreBlue()');
var last = $scope.blueImages[$scope.blueImages.length - 1];
for(var i = 1; i <= 8; i++) {
$scope.blueImages.push(last + i);
}
};
});
Output
You can jump to the latest bin by adding /latest
to your URL
Keyboard Shortcuts
Shortcut | Action |
---|---|
ctrl + [num] | Toggle nth panel |
ctrl + 0 | Close focused panel |
ctrl + enter | Re-render output. If console visible: run JS in console |
Ctrl + l | Clear the console |
ctrl + / | Toggle comment on selected lines |
ctrl + ] | Indents selected lines |
ctrl + [ | Unindents selected lines |
tab | Code complete & Emmet expand |
ctrl + shift + L | Beautify code in active panel |
ctrl + s | Save & lock current Bin from further changes |
ctrl + shift + s | Open the share options |
ctrl + y | Archive Bin |
Complete list of JS Bin shortcuts |
JS Bin URLs
URL | Action |
---|---|
/ | Show the full rendered output. This content will update in real time as it's updated from the /edit url. |
/edit | Edit the current bin |
/watch | Follow a Code Casting session |
/embed | Create an embeddable version of the bin |
/latest | Load the very latest bin (/latest goes in place of the revision) |
/[username]/last | View the last edited bin for this user |
/[username]/last/edit | Edit the last edited bin for this user |
/[username]/last/watch | Follow the Code Casting session for the latest bin for this user |
/quiet | Remove analytics and edit button from rendered output |
.js | Load only the JavaScript for a bin |
.css | Load only the CSS for a bin |
Except for username prefixed urls, the url may start with http://jsbin.com/abc and the url fragments can be added to the url to view it differently. |