Skip to content

Commit 49d084b

Browse files
committed
Fixes #181 usign modal option with custom css theme
1 parent 11e9a48 commit 49d084b

File tree

4 files changed

+39
-13
lines changed

4 files changed

+39
-13
lines changed

demo/themeCss.html

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,19 @@
7777
visibility: visible;
7878
}
7979

80+
.noty_modal.someOtherTheme {
81+
position: fixed;
82+
width: 100%;
83+
height: 100%;
84+
background-color: #000;
85+
z-index: 10000;
86+
opacity: 0.6;
87+
display: none;
88+
border: none;
89+
left: 0;
90+
top: 0
91+
}
92+
8093
</style>
8194

8295
</head>
@@ -103,17 +116,18 @@
103116
layout : theme == 'defaultTheme' ? 'topCenter' : 'bottomCenter',
104117
theme : theme,
105118
closeWith : ['button', 'click'],
106-
maxVisible : 20
119+
maxVisible : 20,
120+
modal : true
107121
});
108122
console.log('html: ' + n.options.id);
109123
}
110124

111125
function generateAll() {
112-
generate('alert', 'defaultTheme');
113-
generate('information', 'defaultTheme');
114-
generate('error', 'defaultTheme');
115-
generate('warning', 'defaultTheme');
116-
generate('success', 'defaultTheme');
126+
// generate('alert', 'defaultTheme');
127+
// generate('information', 'defaultTheme');
128+
// generate('error', 'defaultTheme');
129+
// generate('warning', 'defaultTheme');
130+
// generate('success', 'defaultTheme');
117131

118132
generate('alert', 'someOtherTheme');
119133
generate('information', 'someOtherTheme');

js/noty/jquery.noty.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* noty - jQuery Notification Plugin v2.2.0
2+
* noty - jQuery Notification Plugin v2.2.2
33
* Contributors: https://github.com/needim/noty/graphs/contributors
44
*
55
* Examples and Documentation - http://needim.github.com/noty/
@@ -356,8 +356,14 @@ if (typeof Object.create !== 'function') {
356356
};
357357

358358
$.notyRenderer.createModalFor = function (notification) {
359-
if ($('.noty_modal').length == 0)
360-
$('<div/>').addClass('noty_modal').data('noty_modal_count', 0).css(notification.options.theme.modal.css).prependTo($('body')).fadeIn('fast');
359+
if ($('.noty_modal').length == 0) {
360+
var modal = $('<div/>').addClass('noty_modal').addClass(notification.options.theme).data('noty_modal_count', 0);
361+
362+
if (notification.options.theme.modal && notification.options.theme.modal.css)
363+
modal.css(notification.options.theme.modal.css);
364+
365+
modal.prependTo($('body')).fadeIn('fast');
366+
}
361367
};
362368

363369
$.notyRenderer.getLayoutCountFor = function (notification) {

js/noty/packaged/jquery.noty.packaged.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* noty - jQuery Notification Plugin v2.2.0
2+
* noty - jQuery Notification Plugin v2.2.2
33
* Contributors: https://github.com/needim/noty/graphs/contributors
44
*
55
* Examples and Documentation - http://needim.github.com/noty/
@@ -356,8 +356,14 @@ if (typeof Object.create !== 'function') {
356356
};
357357

358358
$.notyRenderer.createModalFor = function (notification) {
359-
if ($('.noty_modal').length == 0)
360-
$('<div/>').addClass('noty_modal').data('noty_modal_count', 0).css(notification.options.theme.modal.css).prependTo($('body')).fadeIn('fast');
359+
if ($('.noty_modal').length == 0) {
360+
var modal = $('<div/>').addClass('noty_modal').addClass(notification.options.theme).data('noty_modal_count', 0);
361+
362+
if (notification.options.theme.modal && notification.options.theme.modal.css)
363+
modal.css(notification.options.theme.modal.css);
364+
365+
modal.prependTo($('body')).fadeIn('fast');
366+
}
361367
};
362368

363369
$.notyRenderer.getLayoutCountFor = function (notification) {

0 commit comments

Comments
 (0)