Browse Source

Fixes modal to remove scroll bars when modal is visible, fixes #787

pull/1063/head
jlukic 10 years ago
parent
commit
712562175d
6 changed files with 39 additions and 23 deletions
  1. 5
      src/definitions/modules/dimmer.js
  2. 8
      src/definitions/modules/dimmer.less
  3. 2
      src/definitions/modules/modal.js
  4. 28
      src/definitions/modules/modal.less
  5. 2
      src/themes/packages/default/elements/image.variables
  6. 17
      src/themes/packages/default/modules/modal.variables

5
src/definitions/modules/dimmer.js

@ -85,7 +85,6 @@ $.fn.dimmer = function(parameters) {
.on(clickEvent + eventNamespace, module.toggle) .on(clickEvent + eventNamespace, module.toggle)
; ;
} }
console.log($module, module.is.page());
if( module.is.page() ) { if( module.is.page() ) {
module.debug('Setting as a page dimmer', $dimmable); module.debug('Setting as a page dimmer', $dimmable);
module.set.pageDimmer(); module.set.pageDimmer();
@ -192,13 +191,13 @@ $.fn.dimmer = function(parameters) {
; ;
if(settings.on != 'hover' && settings.useCSS && $.fn.transition !== undefined && $dimmer.transition('is supported')) { if(settings.on != 'hover' && settings.useCSS && $.fn.transition !== undefined && $dimmer.transition('is supported')) {
module.verbose('Hiding dimmer with css'); module.verbose('Hiding dimmer with css');
module.remove.dimmed();
$dimmer $dimmer
.transition({ .transition({
animation : settings.transition + ' out', animation : settings.transition + ' out',
duration : module.get.duration(), duration : module.get.duration(),
queue : true, queue : true,
complete : function() { complete : function() {
module.remove.dimmed();
module.remove.active(); module.remove.active();
callback(); callback();
} }
@ -207,11 +206,11 @@ $.fn.dimmer = function(parameters) {
} }
else { else {
module.verbose('Hiding dimmer with javascript'); module.verbose('Hiding dimmer with javascript');
module.remove.dimmed();
$dimmer $dimmer
.stop() .stop()
.fadeOut(module.get.duration(), function() { .fadeOut(module.get.duration(), function() {
$dimmer.removeAttr('style'); $dimmer.removeAttr('style');
module.remove.dimmed();
module.remove.active(); module.remove.active();
callback(); callback();
}) })

8
src/definitions/modules/dimmer.less

@ -108,9 +108,11 @@
transform-origin: center center; transform-origin: center center;
} }
.ui.scrolling.dimmable > .dimmer,
.ui.scrolling.page.dimmer {
position: absolute;
body.ui.dimmed.dimmable {
overflow: hidden;
}
body.ui.dimmable > .dimmer {
position: fixed;
} }
body.ui.dimmed.dimmable > :not(.dimmer){ body.ui.dimmed.dimmable > :not(.dimmer){

2
src/definitions/modules/modal.js

@ -510,7 +510,7 @@ $.fn.modal = function(parameters) {
else { else {
$module $module
.css({ .css({
marginTop : '1em',
marginTop : '',
top : $document.scrollTop() top : $document.scrollTop()
}) })
; ;

28
src/definitions/modules/modal.less

@ -90,6 +90,7 @@
background: @headerBackground; background: @headerBackground;
margin: @headerMargin; margin: @headerMargin;
padding: @headerPadding; padding: @headerPadding;
box-shadow: @headerBoxShadow;
font-size: @headerFontSize; font-size: @headerFontSize;
font-weight: @headerFontWeight; font-weight: @headerFontWeight;
@ -104,6 +105,7 @@
.ui.modal > .content { .ui.modal > .content {
position: relative; position: relative;
display: table; display: table;
table-layout: fixed;
width: 100%; width: 100%;
font-size: @contentFontSize; font-size: @contentFontSize;
line-height: @contentLineHeight; line-height: @contentLineHeight;
@ -112,21 +114,26 @@
} }
.ui.modal > .content > .image { .ui.modal > .content > .image {
display: table-cell; display: table-cell;
padding-right: @imagePadding;
min-width: @imageMinWidth;
width: @imageWidth;
vertical-align: @imageVerticalAlign; vertical-align: @imageVerticalAlign;
} }
.ui.modal > .content > .description { .ui.modal > .content > .description {
display: table-cell; display: table-cell;
vertical-align: top; vertical-align: top;
padding-left: @descriptionPadding;
min-width: @descriptionMinWidth; min-width: @descriptionMinWidth;
vertical-align: @descriptionVerticalAlign; vertical-align: @descriptionVerticalAlign;
} }
.ui.modal > .content > .icon + .description,
.ui.modal > .content > .image + .description {
padding-left: @descriptionDistance;
}
/*rtl:ignore*/ /*rtl:ignore*/
.ui.modal > .content > .image > i.icon { .ui.modal > .content > .image > i.icon {
font-size: @imageIconSize; font-size: @imageIconSize;
margin: 0em; margin: 0em;
opacity: 1;
} }
/*-------------- /*--------------
@ -231,6 +238,9 @@
.ui.basic.modal > .actions { .ui.basic.modal > .actions {
background-color: transparent; background-color: transparent;
} }
.ui.basic.modal > .header {
color: @basicModalHeaderColor;
}
.ui.basic.modal > .close { .ui.basic.modal > .close {
top: @basicModalCloseTop; top: @basicModalCloseTop;
right: @basicModalCloseRight; right: @basicModalCloseRight;
@ -242,12 +252,16 @@
/* A modal that cannot fit on the page */ /* A modal that cannot fit on the page */
body.ui.scrolling.dimmable {
height: auto;
.ui.scrolling.dimmable {
overflow: hidden;
}
.ui.scrolling.dimmable > .dimmer {
position: fixed;
overflow: auto;
} }
.ui.modal.scrolling { .ui.modal.scrolling {
position: absolute;
margin-top: @scrollingTopMargin;
position: static;
margin: @scrollingMargin auto;
} }
/******************************* /*******************************

2
src/themes/packages/default/elements/image.variables

@ -6,7 +6,7 @@
Element Element
--------------------*/ --------------------*/
@placeholderColor: rgba(0, 0, 0, 0.05);
@placeholderColor: transparent;
@roundedBorderRadius: 0.3125em; @roundedBorderRadius: 0.3125em;
@imageHorizontalMargin: 0.25rem; @imageHorizontalMargin: 0.25rem;

17
src/themes/packages/default/modules/modal.variables

@ -23,9 +23,10 @@
/* Header */ /* Header */
@headerMargin: 0em; @headerMargin: 0em;
@headerPadding: 1.5rem 2rem; @headerPadding: 1.5rem 2rem;
@headerBackground: @lightBlack;
@headerColor: @white;
@headerBackground: @subtleGradient @white;
@headerColor: @darkTextColor;
@headerFontSize: 1.6em; @headerFontSize: 1.6em;
@headerBoxShadow: @subtleShadow;
@headerFontWeight: bold; @headerFontWeight: bold;
@headerFontFamily: @headerFont; @headerFontFamily: @headerFont;
@headerBorder: 1px solid @borderColor; @headerBorder: 1px solid @borderColor;
@ -36,13 +37,12 @@
@contentLineHeight: 1.4; @contentLineHeight: 1.4;
@contentBackground: #FFFFFF; @contentBackground: #FFFFFF;
/* Left / Right */
@imageMinWidth: 25%;
@imagePadding: 1em;
/* Image / Description */
@imageWidth: '';
@imageIconSize: 8rem; @imageIconSize: 8rem;
@imageVerticalAlign: top; @imageVerticalAlign: top;
@descriptionPadding: 1em;
@descriptionDistance: 1em;
@descriptionMinWidth: ''; @descriptionMinWidth: '';
@descriptionVerticalAlign: top; @descriptionVerticalAlign: top;
@ -60,7 +60,7 @@
@mobileButtonDistance: 1em; @mobileButtonDistance: 1em;
/* Inner Close Position (Responsive) */ /* Inner Close Position (Responsive) */
@innerCloseTop: 1.5rem;
@innerCloseTop: 1rem;
@innerCloseRight: 1rem; @innerCloseRight: 1rem;
@innerCloseColor: @textColor; @innerCloseColor: @textColor;
@ -86,12 +86,13 @@
--------------------*/ --------------------*/
/* Basic */ /* Basic */
@basicModalHeaderColor: @white;
@basicModalColor: @white; @basicModalColor: @white;
@basicModalCloseTop: 1.5rem; @basicModalCloseTop: 1.5rem;
@basicModalCloseRight: 1rem; @basicModalCloseRight: 1rem;
/* Scrolling Margin */ /* Scrolling Margin */
@scrollingTopMargin: 1rem;
@scrollingMargin: 3rem;
/*------------------- /*-------------------

Loading…
Cancel
Save