Merge pull request #2590 from alphagov/fix-sticky-init

Fix issues with JS for sticky elements
This commit is contained in:
Tom Byers
2018-12-17 13:29:19 +00:00
committed by GitHub
2 changed files with 182 additions and 111 deletions

View File

@@ -37,8 +37,6 @@
this.$form.on('click', 'button.button-secondary', (event) => this.actionButtonClicked(event));
this.$form.on('change', 'input[type=checkbox]', () => this.templateFolderCheckboxChanged());
this.render();
};
this.addCancelButton = function(state) {
@@ -122,6 +120,11 @@
this.states.forEach(
state => (state.key === this.currentState ? this.$stickyBottom.append(state.$el) : state.$el.detach())
);
// make sticky JS recalculate its cache of the element's position
if ('stickAtBottomWhenScrolling' in GOVUK) {
GOVUK.stickAtBottomWhenScrolling.recalculate();
}
};
this.nothingSelectedButtons = `