diff --git a/js/angular-sticky.js b/js/angular-sticky.js index 582ca45..5504a93 100755 --- a/js/angular-sticky.js +++ b/js/angular-sticky.js @@ -460,6 +460,7 @@ angular.module('hl.sticky', []) $get: function($rootScope, $window, $document, $log, DefaultStickyStackName, hlStickyElement, hlStickyStack, throttle) { var windowEl = angular.element($window); + var windowWidth = window.innerWidth; var unbindViewContentLoaded; var unbindIncludeContentLoaded; @@ -474,7 +475,15 @@ angular.module('hl.sticky', []) } // bind events - throttledResize = throttle(resize, $stickyElement.defaults.checkDelay, {leading: false}); + throttledResize = function(event) { + + var newWidth = window.innerWidth; + + if (windowWidth != newWidth) { + throttle(resize, $stickyElement.defaults.checkDelay, {leading: false})(arguments); + windowWidth = newWidth; + } + }; windowEl.on('resize', throttledResize); windowEl.on('scroll', drawEvent); @@ -687,4 +696,4 @@ angular.module('hl.sticky', []) } }; }; - }); \ No newline at end of file + });