mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -04:00
Move setting of events into separate method
This commit is contained in:
@@ -310,6 +310,7 @@
|
|||||||
Sticky.prototype.recalculate = function (opts) {
|
Sticky.prototype.recalculate = function (opts) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var onSyncComplete = function () {
|
var onSyncComplete = function () {
|
||||||
|
self.setEvents();
|
||||||
if (_mode === 'dialog') {
|
if (_mode === 'dialog') {
|
||||||
dialog.fitToHeight(self);
|
dialog.fitToHeight(self);
|
||||||
dialog.adjustForResize(self);
|
dialog.adjustForResize(self);
|
||||||
@@ -425,24 +426,23 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
Sticky.prototype.init = function (opts) {
|
Sticky.prototype.init = function (opts) {
|
||||||
|
this.recalculate(opts);
|
||||||
|
};
|
||||||
|
Sticky.prototype.setEvents = function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
if (this._els.length) {
|
// flag when scrolling takes place and check (and re-position) sticky elements relative to
|
||||||
// flag when scrolling takes place and check (and re-position) sticky elements relative to
|
// window position
|
||||||
// window position
|
if (self._scrollTimeout === false) {
|
||||||
if (self._scrollTimeout === false) {
|
$(global).scroll(function (e) { self.onScroll(); });
|
||||||
$(global).scroll(function (e) { self.onScroll(); });
|
self._scrollTimeout = global.setInterval(function (e) { self.checkScroll(); }, 50);
|
||||||
self._scrollTimeout = global.setInterval(function (e) { self.checkScroll(); }, 50);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Recalculate all dimensions when the window resizes
|
|
||||||
if (self._resizeTimeout === false) {
|
|
||||||
$(global).resize(function (e) { self.onResize(); });
|
|
||||||
self._resizeTimeout = global.setInterval(function (e) { self.checkResize(); }, 50);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.recalculate(opts);
|
// Recalculate all dimensions when the window resizes
|
||||||
|
if (self._resizeTimeout === false) {
|
||||||
|
$(global).resize(function (e) { self.onResize(); });
|
||||||
|
self._resizeTimeout = global.setInterval(function (e) { self.checkResize(); }, 50);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
Sticky.prototype.viewportIsWideEnough = function (windowWidth) {
|
Sticky.prototype.viewportIsWideEnough = function (windowWidth) {
|
||||||
return windowWidth > 768;
|
return windowWidth > 768;
|
||||||
|
|||||||
Reference in New Issue
Block a user