fixed stickyfeeds
This commit is contained in:
parent
6a1a4f2746
commit
06f4cd420c
1 changed files with 8 additions and 8 deletions
|
|
@ -1,12 +1,13 @@
|
||||||
"use strict";
|
/* globals $ */
|
||||||
|
'use strict';
|
||||||
|
|
||||||
var sticky_feeds = {
|
const sticky_feeds = {
|
||||||
aside: null,
|
aside: null,
|
||||||
tree: null,
|
tree: null,
|
||||||
window: null,
|
window: null,
|
||||||
|
|
||||||
init: function() {
|
init: function () {
|
||||||
if (window.matchMedia("(max-width: 840px)").matches) {
|
if (window.matchMedia('(max-width: 840px)').matches) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -34,14 +35,14 @@ var sticky_feeds = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
scroller: function() {
|
scroller: function () {
|
||||||
var pos_top_window = sticky_feeds.window.scrollTop();
|
const pos_top_window = sticky_feeds.window.scrollTop();
|
||||||
|
|
||||||
if (pos_top_window < sticky_feeds.aside.initial_pos.top + sticky_feeds.tree.initial_pos.top) {
|
if (pos_top_window < sticky_feeds.aside.initial_pos.top + sticky_feeds.tree.initial_pos.top) {
|
||||||
// scroll top has not reached the top of the sticky tree yet so it
|
// scroll top has not reached the top of the sticky tree yet so it
|
||||||
// stays in place but its height must adapted:
|
// stays in place but its height must adapted:
|
||||||
// window height - sticky tree pos top + actual scroll top
|
// window height - sticky tree pos top + actual scroll top
|
||||||
var real_tree_pos_top = sticky_feeds.aside.initial_pos.top + sticky_feeds.tree.initial_pos.top;
|
const real_tree_pos_top = sticky_feeds.aside.initial_pos.top + sticky_feeds.tree.initial_pos.top;
|
||||||
sticky_feeds.tree.css('top', sticky_feeds.tree.initial_pos.top);
|
sticky_feeds.tree.css('top', sticky_feeds.tree.initial_pos.top);
|
||||||
sticky_feeds.tree.css('height', sticky_feeds.window.height - real_tree_pos_top + pos_top_window);
|
sticky_feeds.tree.css('height', sticky_feeds.window.height - real_tree_pos_top + pos_top_window);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -55,5 +56,4 @@ var sticky_feeds = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
window.onload = sticky_feeds.init;
|
window.onload = sticky_feeds.init;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue