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="tohide()">Hide me ! and toogle stick / unstick element below</button>
<div id="parent"">
<div class="toggling" ng-hide="hide"></div>
<div class="sticky" sticky>It's Sticky!</div>
<div class="deep"></div>
</div>
</div>
CSS
#parent{
height: 200px;
overflow: scroll;
}
.toggling{
height: 50px;
background-color:yellow;
}
.sticky{
background-color:green;
}
.deep{
background-color:red;
height: 650px;
}
JavaScript
'use strict';
var app = angular.module('myApp', ['sticky']);
app.controller('stickyCtrl', function($scope) {
$scope.hide = 0;
$scope.tohide = function(){
$scope.hide = 1;
};
});