mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -04:00
Allow setting of scroll area explicitly
Defaults to scroll area being the parent element of the sticky element, if not set.
This commit is contained in:
@@ -42,8 +42,11 @@
|
|||||||
|
|
||||||
// Constructor for objects holding data for each element to have sticky behaviour
|
// Constructor for objects holding data for each element to have sticky behaviour
|
||||||
var StickyElement = function ($el, sticky) {
|
var StickyElement = function ($el, sticky) {
|
||||||
|
var $scrollArea = $el.closest('.sticky-scroll-area');
|
||||||
|
|
||||||
this._sticky = sticky;
|
this._sticky = sticky;
|
||||||
this.$fixedEl = $el;
|
this.$fixedEl = $el;
|
||||||
|
this.$scrollArea = $scrollArea.length ? $scrollArea : $el.parent();
|
||||||
this._initialFixedClass = 'content-fixed-onload';
|
this._initialFixedClass = 'content-fixed-onload';
|
||||||
this._fixedClass = 'content-fixed';
|
this._fixedClass = 'content-fixed';
|
||||||
this._appliedClass = null;
|
this._appliedClass = null;
|
||||||
@@ -390,7 +393,7 @@
|
|||||||
};
|
};
|
||||||
Sticky.prototype.setElWidth = function (el) {
|
Sticky.prototype.setElWidth = function (el) {
|
||||||
var $el = el.$fixedEl;
|
var $el = el.$fixedEl;
|
||||||
var width = $el.parent().width();
|
var width = el.$scrollArea.width();
|
||||||
|
|
||||||
el.horizontalSpace = width;
|
el.horizontalSpace = width;
|
||||||
// if stuck, element won't inherit width from parent so set explicitly
|
// if stuck, element won't inherit width from parent so set explicitly
|
||||||
|
|||||||
@@ -74,6 +74,7 @@
|
|||||||
|
|
||||||
{% if current_user.has_permissions('manage_templates') %}
|
{% if current_user.has_permissions('manage_templates') %}
|
||||||
{% call form_wrapper(
|
{% call form_wrapper(
|
||||||
|
class='sticky-scroll-area',
|
||||||
module='template-folder-form',
|
module='template-folder-form',
|
||||||
data_kwargs={'prev-state': templates_and_folders_form.op or None}
|
data_kwargs={'prev-state': templates_and_folders_form.op or None}
|
||||||
) %}
|
) %}
|
||||||
|
|||||||
Reference in New Issue
Block a user