this.id = this.$element.attr('id');
this.isActive = false;
this.cached = {mq: MediaQuery.current};
- this.isMobile = mobileSniff();
this.$anchor = $(`[data-open="${this.id}"]`).length ? $(`[data-open="${this.id}"]`) : $(`[data-toggle="${this.id}"]`);
this.$anchor.attr({
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);
+ if ($(document).height() > $(window).height()) {
+ var scrollTop = parseInt($("html").css("top"));
+ $("html")
+ .css("top", "");
+ $(window).scrollTop(-scrollTop);
+ }
}
function addRevealOpenClasses() {
- $('body').addClass('is-reveal-open');
+ $('html').addClass('is-reveal-open');
}
// Motion UI method of reveal
function finishUp() {
if ($('.reveal:visible').length === 0) {
- $('body').removeClass('is-reveal-open');
+ $('html').removeClass('is-reveal-open');
}
Keyboard.releaseFocus(_this.$element);
additionalOverlayClasses: ''
};
-function iPhoneSniff() {
- return /iP(ad|hone|od).*OS/.test(window.navigator.userAgent);
-}
-
-function androidSniff() {
- return /Android/.test(window.navigator.userAgent);
-}
-
-function mobileSniff() {
- return iPhoneSniff() || androidSniff();
-}
-
export {Reveal};
}
@mixin foundation-reveal {
- // [TODO] Is this necessary?
- body.is-reveal-open { // sass-lint:disable-line no-qualifying-elements
- overflow: hidden;
- }
- // html gets this class only in iOS
- html.is-reveal-open,
- html.is-reveal-open body {
- min-height: 100%;
- overflow: hidden;
+ /// Disables the scroll when Reveal is shown to prevent the background from shifting
+ html.is-reveal-open {
position: fixed;
- user-select: none;
+ width: 100%;
+ overflow-y: scroll;
+
+ body { // sass-lint:disable-line no-qualifying-elements
+ overflow: hidden;
+ }
}
// Overlay
}
}
}
-
-
-/// Disables the scroll when Reveal is shown to prevent the background from shifting
-html.disable-scroll {
- position: fixed;
- width: 100%;
- overflow-y: scroll;
-}