this.$container = $parent.length ? $parent : $(this.options.container).wrapInner(this.$element);
this.$container.addClass(this.options.containerClass);
- this.$element.addClass(this.options.stickyClass)
- .attr({'data-resize': id});
+ this.$element.addClass(this.options.stickyClass).attr({ 'data-resize': id, 'data-mutate': id });
+ if (this.options.anchor !== '') {
+ $('#' + _this.options.anchor).attr({ 'data-mutate': id });
+ }
this.scrollCount = this.options.checkEvery;
this.isStuck = false;
}
});
});
+
+ this.$element.on('mutateme.zf.trigger', function (e, el, ms, mr) {
+ _this._setSizes(function () {
+ _this._calc(false);
+ if (_this.canStick) {
+ if (!_this.isOn) {
+ _this._events(id);
+ }
+ } else if (_this.isOn) {
+ _this._pauseListeners(scrollListener);
+ }
+ });
+ });
+
+ this.$anchor.on('mutateme.zf.trigger', function (e, el, ms, mr) {
+ _this._setSizes(function () {
+ _this._calc(false);
+ if (_this.canStick) {
+ if (!_this.isOn) {
+ _this._events(id);
+ }
+ } else if (_this.isOn) {
+ _this._pauseListeners(scrollListener);
+ }
+ });
+ });
}
/**
bottom: '',
'max-width': ''
})
- .off('resizeme.zf.trigger');
+ .off('resizeme.zf.trigger')
+ .off('mutateme.zf.trigger');
if (this.$anchor && this.$anchor.length) {
this.$anchor.off('change.zf.sticky');
}