diff --git a/app/assets/javascripts/stick-to-window-when-scrolling.js b/app/assets/javascripts/stick-to-window-when-scrolling.js index 9eeaa65ed..33dcc4b80 100644 --- a/app/assets/javascripts/stick-to-window-when-scrolling.js +++ b/app/assets/javascripts/stick-to-window-when-scrolling.js @@ -42,8 +42,11 @@ // Constructor for objects holding data for each element to have sticky behaviour var StickyElement = function ($el, sticky) { + var $scrollArea = $el.closest('.sticky-scroll-area'); + this._sticky = sticky; this.$fixedEl = $el; + this.$scrollArea = $scrollArea.length ? $scrollArea : $el.parent(); this._initialFixedClass = 'content-fixed-onload'; this._fixedClass = 'content-fixed'; this._appliedClass = null; @@ -390,7 +393,7 @@ }; Sticky.prototype.setElWidth = function (el) { var $el = el.$fixedEl; - var width = $el.parent().width(); + var width = el.$scrollArea.width(); el.horizontalSpace = width; // if stuck, element won't inherit width from parent so set explicitly diff --git a/app/templates/views/templates/choose.html b/app/templates/views/templates/choose.html index ee4cc105d..4f999bb23 100644 --- a/app/templates/views/templates/choose.html +++ b/app/templates/views/templates/choose.html @@ -74,6 +74,7 @@ {% if current_user.has_permissions('manage_templates') %} {% call form_wrapper( + class='sticky-scroll-area', module='template-folder-form', data_kwargs={'prev-state': templates_and_folders_form.op or None} ) %}