fix scrolltop cross-browser compat.
This commit is contained in:
parent
8fd84e2df4
commit
e01a798912
|
@ -3,7 +3,6 @@ html
|
||||||
font-size: 1.0rem
|
font-size: 1.0rem
|
||||||
@media (min-width: 960px)
|
@media (min-width: 960px)
|
||||||
font-size: 1.15rem
|
font-size: 1.15rem
|
||||||
height: 100%
|
|
||||||
|
|
||||||
|
|
||||||
body, h1, h2, h3, h4, .content-column-content p, .content-column-content li, .box-masonry .box-masonry-text p
|
body, h1, h2, h3, h4, .content-column-content p, .content-column-content li, .box-masonry .box-masonry-text p
|
||||||
|
|
|
@ -29,7 +29,7 @@ $(function() {
|
||||||
|
|
||||||
function scrollThenFixSidebar() {
|
function scrollThenFixSidebar() {
|
||||||
var maxHeight = $('.sidebar-content').height() - $(window).height() + 40;
|
var maxHeight = $('.sidebar-content').height() - $(window).height() + 40;
|
||||||
$('body').on('scroll', function(e) {
|
$(document).on('scroll', function(e) {
|
||||||
var s = document.scrollingElement.scrollTop || $('html').scrollTop() || $('body').scrollTop();
|
var s = document.scrollingElement.scrollTop || $('html').scrollTop() || $('body').scrollTop();
|
||||||
if(s > maxHeight) {
|
if(s > maxHeight) {
|
||||||
$('.sidebar-content').addClass('sidebar-fixed').removeClass('sidebar-scrolling');
|
$('.sidebar-content').addClass('sidebar-fixed').removeClass('sidebar-scrolling');
|
||||||
|
|
Loading…
Reference in New Issue