else{ this.close(); }
}
+ /**
+ * Disables the scroll when Reveal is shown to prevent the background from shifting
+ */
+ _disableScroll(){
+ if ($(document).height() > $(window).height()) {
+ var scrollTop = $(window).scrollTop();
+ $("html")
+ .addClass("disable-scroll")
+ .css("top", -scrollTop);
+ }
+ }
+
+ /**
+ * Reenables the scroll when Reveal closes
+ */
+ _enableScroll(){
+ var scrollTop = parseInt($("html").css("top"));
+ $("html")
+ .removeClass("disable-scroll")
+ .css("top", "");
+ $(window).scrollTop(-scrollTop);
+ }
+
/**
* Opens the modal controlled by `this.$anchor`, and closes all others by default.
this.$element.trigger('closeme.zf.reveal', this.id);
}
+ this._disableScroll();
+
var _this = this;
function addRevealOpenClasses() {
_this.$element.attr('aria-hidden', true);
+ _this._enableScroll();
+
/**
* Fires when the modal is done closing.
* @event Reveal#closed