Browse Source

Add #1897 dimmer now has an opacity setting

pull/1785/merge
jlukic 9 years ago
parent
commit
e3b3ab4e97
2 changed files with 42 additions and 2 deletions
  1. 1
      RELEASE-NOTES.md
  2. 43
      src/definitions/modules/dimmer.js

1
RELEASE-NOTES.md

@ -10,6 +10,7 @@
- **Loader** - `inline loader` now has a `centered` variation - **Loader** - `inline loader` now has a `centered` variation
- **Transition** - Added `toggle` behavior and docs for `show` and `hide` - **Transition** - Added `toggle` behavior and docs for `show` and `hide`
- **Transition** - transition now has `stop`, `stop all`, and `clear queue` for removing transitions, (undocumented method `stop`, and `start` renamed to `enable` and `disable`) - **Transition** - transition now has `stop`, `stop all`, and `clear queue` for removing transitions, (undocumented method `stop`, and `start` renamed to `enable` and `disable`)
- **Dimmer** - Add `opacity` setting to override css value. Add to docs several undocumented settings, like `useCSS`, and `variation`.
**Bugs** **Bugs**
- **Dropdown** - Fixes issue where dropdown would not open after restoring previus value on failed `search dropdown` search - **Dropdown** - Fixes issue where dropdown would not open after restoring previus value on failed `search dropdown` search

43
src/definitions/modules/dimmer.js

@ -215,6 +215,9 @@ $.fn.dimmer = function(parameters) {
: function(){} : function(){}
; ;
if(settings.useCSS && $.fn.transition !== undefined && $dimmer.transition('is supported')) { if(settings.useCSS && $.fn.transition !== undefined && $dimmer.transition('is supported')) {
if(settings.opacity !== 'auto') {
module.set.opacity();
}
$dimmer $dimmer
.transition({ .transition({
animation : settings.transition + ' in', animation : settings.transition + ' in',
@ -234,6 +237,9 @@ $.fn.dimmer = function(parameters) {
else { else {
module.verbose('Showing dimmer animation with javascript'); module.verbose('Showing dimmer animation with javascript');
module.set.dimmed(); module.set.dimmed();
if(settings.opacity == 'auto') {
settings.opacity = 0.8;
}
$dimmer $dimmer
.stop() .stop()
.css({ .css({
@ -241,7 +247,7 @@ $.fn.dimmer = function(parameters) {
width : '100%', width : '100%',
height : '100%' height : '100%'
}) })
.fadeTo(module.get.duration(), 1, function() {
.fadeTo(module.get.duration(), settings.opacity, function() {
$dimmer.removeAttr('style'); $dimmer.removeAttr('style');
module.set.active(); module.set.active();
callback(); callback();
@ -361,6 +367,24 @@ $.fn.dimmer = function(parameters) {
}, },
set: { set: {
opacity: function(opacity) {
var
opacity = settings.opacity || opacity,
color = $dimmer.css('background-color'),
colorArray = color.split(','),
isRGBA = (colorArray && colorArray.length == 4)
;
if(isRGBA) {
colorArray[3] = opacity + ')';
color = colorArray.join(',');
}
else {
color = 'rgba(0, 0, 0, ' + opacity + ')';
}
module.debug('Setting opacity to', opacity);
console.log(color);
$dimmer.css('background-color', color);
},
active: function() { active: function() {
$dimmer.addClass(className.active); $dimmer.addClass(className.active);
}, },
@ -583,13 +607,28 @@ $.fn.dimmer.settings = {
verbose : true, verbose : true,
performance : true, performance : true,
// name to distinguish between multiple dimmers in context
dimmerName : false, dimmerName : false,
// whether to add a variation type
variation : false, variation : false,
// whether to bind close events
closable : 'auto', closable : 'auto',
transition : 'fade',
// whether to use css animations
useCSS : true, useCSS : true,
// css animation to use
transition : 'fade',
// event to bind to
on : false, on : false,
// overriding opacity value
opacity : 'auto',
// transition durations
duration : { duration : {
show : 500, show : 500,
hide : 500 hide : 500

Loading…
Cancel
Save