From 752e531733d4a7e8c41f0827d26192c6967c12e5 Mon Sep 17 00:00:00 2001 From: Aligatro Date: Tue, 26 Feb 2019 18:25:56 +0200 Subject: [PATCH] Chrome docktype bug fix https://stackoverflow.com/a/12902057 --- jquery.sticky.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jquery.sticky.js b/jquery.sticky.js index fe433c5..3f8a8a2 100644 --- a/jquery.sticky.js +++ b/jquery.sticky.js @@ -39,7 +39,9 @@ $window = $(window), $document = $(document), sticked = [], - windowHeight = $window.height(), + doctype = document.documentElement.previousSibling, + sticked = [], + windowHeight = (doctype) ? $window.height() : $window.prop('innerHeight'), scroller = function() { var scrollTop = $window.scrollTop(), documentHeight = $document.height(), @@ -134,7 +136,7 @@ } }, resizer = function() { - windowHeight = $window.height(); + windowHeight = (doctype) ? $window.height() : $window.prop('innerHeight'); for (var i = 0, l = sticked.length; i < l; i++) { var s = sticked[i];