unStick Element failed when position of this element change
by Guillaume Seguin
HTML
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script>
<script src="https://cdn.rawgit.com/d-oliveros/ngSticky/v1.7.9/lib/sticky.js"></script>
<script src="https://cdn.rawgit.com/paulirish/matchMedia.js/master/matchMedia.js"></script>
<div ng-controller="stickyCtrl">
<button ng-click="add()">Hide me and toogle stick / unstick element below</button>
<div ng-repeat="item in itemList" ng-show="$last">
<div class="sticky" sticky>It's Sticky! <span ng-bind="item"/></div>
<div class="deep"></div>
</div>
</div>
CSS
.sticky{
background-color:green;
}
.deep{
background-color:red;
height: 650px;
}
JavaScript
'use strict';
var app = angular.module('myApp', ['sticky']);
app.controller('stickyCtrl', function($scope) {
var i = 1;
$scope.itemList = [];
$scope.add = function(){
$scope.itemList.push(i++);
};
$scope.add();
});