aboutsummaryrefslogtreecommitdiffstats
path: root/view/theme
diff options
context:
space:
mode:
Diffstat (limited to 'view/theme')
-rw-r--r--view/theme/redbasic/js/redbasic.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js
index c0c03d4f8..04469cb85 100644
--- a/view/theme/redbasic/js/redbasic.js
+++ b/view/theme/redbasic/js/redbasic.js
@@ -17,8 +17,13 @@ $(document).ready(function() {
}
$('#css3-calc').remove(); // Remove the test element
- stickyScroll('.aside_spacer_left', '.aside_spacer_top_left', '.content', parseFloat(window.getComputedStyle(document.querySelector('#region_1')).getPropertyValue('padding-top')), 0);
- stickyScroll('.aside_spacer_right', '.aside_spacer_top_right', '.content', parseFloat(window.getComputedStyle(document.querySelector('#region_3')).getPropertyValue('padding-top')), 20);
+ if (document.querySelector('#region_1')) {
+ stickyScroll('.aside_spacer_left', '.aside_spacer_top_left', '.content', parseFloat(window.getComputedStyle(document.querySelector('#region_1')).getPropertyValue('padding-top')), 0);
+ }
+
+ if (document.querySelector('#region_3')) {
+ stickyScroll('.aside_spacer_right', '.aside_spacer_top_right', '.content', parseFloat(window.getComputedStyle(document.querySelector('#region_3')).getPropertyValue('padding-top')), 20);
+ }
$('#expand-aside').on('click', function() {
if($('main').hasClass('region_1-on')){
@@ -121,8 +126,14 @@ function setStyle(element, cssProperty) {
}
function stickyScroll(sticky, stickyTop, container, topOffset, bottomOffset) {
+
var lastScrollTop = 0;
var sticky = document.querySelector(sticky);
+
+ if (!sticky) {
+ return;
+ }
+
var stickyHeight = sticky.getBoundingClientRect().height;
var stickyTop = document.querySelector(stickyTop);
var content = document.querySelector(container);