Fix Safari header redraw problem. closes flarum/core#187

This commit is contained in:
Toby Zerner 2015-07-28 10:13:58 +09:30
parent 64d4499385
commit 992e515464
2 changed files with 8 additions and 8 deletions

View File

@ -50,19 +50,20 @@ export default function boot(app) {
app.drawer.hide(); app.drawer.hide();
}); });
const offsetTop = $('#app').offset().top + 1;
// Add a class to the body which indicates that the page has been scrolled // Add a class to the body which indicates that the page has been scrolled
// down. // 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 // Initialize FastClick, which makes links and buttons much more responsive on
// touch devices. // touch devices.
$(() => FastClick.attach(document.body)); $(() => FastClick.attach(document.body));
$('#app').affix({
offset: {top: offsetTop}
});
app.booted = true; app.booted = true;
} }

View File

@ -229,7 +229,6 @@
left: 0; left: 0;
right: 0; right: 0;
z-index: @zindex-header; z-index: @zindex-header;
.clearfix();
.affix & { .affix & {
position: fixed; position: fixed;