/**
* Disables the scroll when Reveal is shown to prevent the background from shifting
+ * @param {number} scrollTop
*/
- _disableScroll(){
+ _disableScroll(scrollTop){
if ($(document).height() > $(window).height()) {
- var scrollTop = $(window).scrollTop();
$("html")
.css("top", -scrollTop);
}
/**
* Reenables the scroll when Reveal closes
+ * @param {number} scrollTop
*/
- _enableScroll(){
+ _enableScroll(scrollTop){
if ($(document).height() > $(window).height()) {
- var scrollTop = parseInt($("html").css("top"));
$("html")
.css("top", "");
$(window).scrollTop(-scrollTop);
this.$element.trigger('closeme.zf.reveal', this.id);
}
- this._disableScroll();
+ var scrollTop = $(window).scrollTop();
+
+ this._disableScroll(scrollTop);
var _this = this;
function finishUp() {
+ var scrollTop = parseInt($("html").css("top"));
+
if ($('.reveal:visible').length === 0) {
$('html').removeClass('is-reveal-open');
}
_this.$element.attr('aria-hidden', true);
- _this._enableScroll();
+ _this._enableScroll(scrollTop);
/**
* Fires when the modal is done closing.