Skip to content

Commit

Permalink
Fixes #181 usign modal option with custom css theme
Browse files Browse the repository at this point in the history
  • Loading branch information
needim committed Jan 21, 2014
1 parent 11e9a48 commit 49d084b
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 13 deletions.
26 changes: 20 additions & 6 deletions demo/themeCss.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,19 @@
visibility: visible;
}

.noty_modal.someOtherTheme {
position: fixed;
width: 100%;
height: 100%;
background-color: #000;
z-index: 10000;
opacity: 0.6;
display: none;
border: none;
left: 0;
top: 0
}

</style>

</head>
Expand All @@ -103,17 +116,18 @@
layout : theme == 'defaultTheme' ? 'topCenter' : 'bottomCenter',
theme : theme,
closeWith : ['button', 'click'],
maxVisible : 20
maxVisible : 20,
modal : true
});
console.log('html: ' + n.options.id);
}

function generateAll() {
generate('alert', 'defaultTheme');
generate('information', 'defaultTheme');
generate('error', 'defaultTheme');
generate('warning', 'defaultTheme');
generate('success', 'defaultTheme');
// generate('alert', 'defaultTheme');
// generate('information', 'defaultTheme');
// generate('error', 'defaultTheme');
// generate('warning', 'defaultTheme');
// generate('success', 'defaultTheme');

generate('alert', 'someOtherTheme');
generate('information', 'someOtherTheme');
Expand Down
12 changes: 9 additions & 3 deletions js/noty/jquery.noty.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* noty - jQuery Notification Plugin v2.2.0
* noty - jQuery Notification Plugin v2.2.2
* Contributors: https://github.com/needim/noty/graphs/contributors
*
* Examples and Documentation - http://needim.github.com/noty/
Expand Down Expand Up @@ -356,8 +356,14 @@ if (typeof Object.create !== 'function') {
};

$.notyRenderer.createModalFor = function (notification) {
if ($('.noty_modal').length == 0)
$('<div/>').addClass('noty_modal').data('noty_modal_count', 0).css(notification.options.theme.modal.css).prependTo($('body')).fadeIn('fast');
if ($('.noty_modal').length == 0) {
var modal = $('<div/>').addClass('noty_modal').addClass(notification.options.theme).data('noty_modal_count', 0);

if (notification.options.theme.modal && notification.options.theme.modal.css)
modal.css(notification.options.theme.modal.css);

modal.prependTo($('body')).fadeIn('fast');
}
};

$.notyRenderer.getLayoutCountFor = function (notification) {
Expand Down
12 changes: 9 additions & 3 deletions js/noty/packaged/jquery.noty.packaged.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* noty - jQuery Notification Plugin v2.2.0
* noty - jQuery Notification Plugin v2.2.2
* Contributors: https://github.com/needim/noty/graphs/contributors
*
* Examples and Documentation - http://needim.github.com/noty/
Expand Down Expand Up @@ -356,8 +356,14 @@ if (typeof Object.create !== 'function') {
};

$.notyRenderer.createModalFor = function (notification) {
if ($('.noty_modal').length == 0)
$('<div/>').addClass('noty_modal').data('noty_modal_count', 0).css(notification.options.theme.modal.css).prependTo($('body')).fadeIn('fast');
if ($('.noty_modal').length == 0) {
var modal = $('<div/>').addClass('noty_modal').addClass(notification.options.theme).data('noty_modal_count', 0);

if (notification.options.theme.modal && notification.options.theme.modal.css)
modal.css(notification.options.theme.modal.css);

modal.prependTo($('body')).fadeIn('fast');
}
};

$.notyRenderer.getLayoutCountFor = function (notification) {
Expand Down
Loading

0 comments on commit 49d084b

Please sign in to comment.