Skip to content
/ noty Public
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion js/jquery.noty.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,20 @@
}
});

$noty.bind('noty.setType', function(event, type) {
$noty.removeClass($noty.data('noty_options').type);

type = $noty.data('noty_options').cssPrefix+type;

$noty.data('noty_options').type = type;

$noty.addClass(type);

if (base.options.layout == 'noty_layout_topCenter' || base.options.layout == 'noty_layout_center') {
$.noty.reCenter($noty);
}
});

$noty.bind('noty.getId', function(event) {
return $noty.data('noty_options').id;
});
Expand Down Expand Up @@ -166,11 +180,22 @@
// API
$.noty.get = function(id) { return $('#'+id); };
$.noty.close = function(id) {
//remove from queue if not already visible
for(var i=0;i<$.noty.queue.length;) {
if($.noty.queue[i].options.id==id)
$.noty.queue.splice(id,1);
else
i++;
}
//close if already visible
$.noty.get(id).trigger('noty.close');
};
$.noty.setText = function(id, text) {
$.noty.get(id).trigger('noty.setText', text);
};
$.noty.setType = function(id, type) {
$.noty.get(id).trigger('noty.setType', type);
};
$.noty.closeAll = function() {
$.noty.clearQueue();
$('.noty_bar').trigger('noty.close');
Expand Down Expand Up @@ -221,4 +246,4 @@
//Helper
function noty(options) {
return jQuery.noty(options); // returns an id
}
}