* @private
*/
_setPosition(cb) {
- var eleDims = Foundation.Box.GetDimensions(this.$element);
- var elePos = this.options.fullScreen ? 'reveal full' : (eleDims.height >= (0.5 * eleDims.windowDims.height)) ? 'reveal' : 'center';
-
- if (elePos === 'reveal full') {
- //set to full height/width
- this.$element
- .offset(Foundation.Box.GetOffsets(this.$element, null, elePos, this.options.vOffset))
- .css({
- 'height': eleDims.windowDims.height,
- 'width': eleDims.windowDims.width
- });
- } else if (!Foundation.MediaQuery.atLeast('medium') || !Foundation.Box.ImNotTouchingYou(this.$element, null, true, false)) {
- //if smaller than medium, resize to 100% width minus any custom L/R margin
- this.$element
- .css({
- 'width': eleDims.windowDims.width - (this.options.hOffset * 2)
- })
- .offset(Foundation.Box.GetOffsets(this.$element, null, 'center', this.options.vOffset, this.options.hOffset));
- //flag a boolean so we can reset the size after the element is closed.
- this.changedSize = true;
- } else {
- this.$element
- .css({
- 'max-height': eleDims.windowDims.height - (this.options.vOffset * (this.options.btmOffsetPct / 100 + 1)),
- 'width': ''
- })
- .offset(Foundation.Box.GetOffsets(this.$element, null, elePos, this.options.vOffset));
- //the max height based on a percentage of vertical offset plus vertical offset
- }
+ if(!this.cached.winWidth || this.updateVals){ this._cacheValues(); }
var x = Math.round((this.cached.winWidth - this.cached.modalDims.width) / 2 - (this.cached.parentOffset.left > 0 ? this.cached.parentOffset.left : 0)),
y = Math.round(window.pageYOffset - (this.cached.parentOffset.top > 0 ? this.cached.parentOffset.top : 0) + this.cached.vertOffset);
/// @type Number
$reveal-max-width: $global-width !default;
-/// Offset from the top of the window when a modal is added.
-/// @type Number
-$reveal-offset: rem-calc(100) !default;
-
/// Default padding inside a modal.
/// @type Number
$reveal-padding: $global-padding !default;
/// Adds base styles for a modal.
@mixin reveal-modal-base {
@include disable-mouse-outline;
-
display: none;
- top: 0;
- left: 0;
z-index: $reveal-zindex + 1;
padding: $reveal-padding;
border: $reveal-border;
background-color: $reveal-background;
border-radius: $reveal-radius;
- overflow-y: auto;
- max-height: 100vh;
@include breakpoint(medium) {
min-height: 0;
height: 100%;
height: 100vh;
min-height: 100vh;
- min-width: 100vw;
max-width: none;
margin-left: 0;
border: 0;
}
@mixin foundation-reveal {
+ // [TODO] Is this necessary?
// scss-lint:disable QualifyingElement
body.is-reveal-open {
overflow: hidden;
position: absolute;
overflow-y: auto;
- @include breakpoint(small) {
- width: 100vw;
- }
-
// Placeholder selector for medium-and-up modals
// Prevents duplicate CSS when defining multiple Reveal sizes
@include breakpoint(medium) {