aboutsummaryrefslogtreecommitdiffstats
path: root/view/theme/redbasic/js
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-02-20 20:18:24 +0000
committerMario <mario@mariovavti.com>2022-02-20 20:18:24 +0000
commit2a60f1cc6ed49ab559090c831788308fe3df0706 (patch)
tree1a5a0a28cbf4aaeb38dc0b08f03c874833500e78 /view/theme/redbasic/js
parent2ddff785e55745045bc9a742b2287a500e5370a6 (diff)
downloadvolse-hubzilla-2a60f1cc6ed49ab559090c831788308fe3df0706.tar.gz
volse-hubzilla-2a60f1cc6ed49ab559090c831788308fe3df0706.tar.bz2
volse-hubzilla-2a60f1cc6ed49ab559090c831788308fe3df0706.zip
merge branch pdledit_gui into dev - many widgets still miss their description and requirements (this is work in progress)
Diffstat (limited to 'view/theme/redbasic/js')
-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);