From 992e515464dec4425370b1db9024c0b8029ebc2c Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Tue, 28 Jul 2015 10:13:58 +0930 Subject: [PATCH] Fix Safari header redraw problem. closes flarum/core#187 --- framework/core/js/forum/src/initializers/boot.js | 15 ++++++++------- framework/core/less/lib/App.less | 1 - 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/framework/core/js/forum/src/initializers/boot.js b/framework/core/js/forum/src/initializers/boot.js index 8c6201b26..9d83a112f 100644 --- a/framework/core/js/forum/src/initializers/boot.js +++ b/framework/core/js/forum/src/initializers/boot.js @@ -50,19 +50,20 @@ export default function boot(app) { app.drawer.hide(); }); - const offsetTop = $('#app').offset().top + 1; - // Add a class to the body which indicates that the page has been scrolled // down. - new ScrollListener(top => $('#app').toggleClass('scrolled', top > offsetTop)).start(); + new ScrollListener(top => { + const $app = $('#app'); + const offset = $app.offset().top; + + $app + .toggleClass('affix', top >= offset) + .toggleClass('scrolled', top > offset); + }).start(); // Initialize FastClick, which makes links and buttons much more responsive on // touch devices. $(() => FastClick.attach(document.body)); - $('#app').affix({ - offset: {top: offsetTop} - }); - app.booted = true; } diff --git a/framework/core/less/lib/App.less b/framework/core/less/lib/App.less index 56b5322f0..2b6006249 100755 --- a/framework/core/less/lib/App.less +++ b/framework/core/less/lib/App.less @@ -229,7 +229,6 @@ left: 0; right: 0; z-index: @zindex-header; - .clearfix(); .affix & { position: fixed;