jpillora / notifyjs

Notify.js - A simple, versatile notification library
https://notifyjs.jpillora.com/
MIT License
1.91k stars 741 forks source link

addStyles - first notification caches the html from the first style #43

Closed Strandedpirate closed 8 years ago

Strandedpirate commented 9 years ago

Notify.js only uses the html from the first style loaded and ignores all others despite being specified in the options.

See the demo below. Two custom styles are added with custom html and the first notification that fires has its html permanently cached and the html from the other style is never loaded for subsequent notifications.

http://jsfiddle.net/StrandedPirate/6bexbrwo/

SebT commented 8 years ago

+1

Edit: My tmp fix

var stylesHtml: {
    style1: 'my html 1',
    style1: 'my html 2',
    style3: 'my html 3',

// ...

// Add this BEFORE calling notify on a jquery element '$elem', 
$elem.siblings('.notifyjs-wrapper').find('.notifyjs-container > div:first-child').html(stylesHtml[style]);
EvanCarroll commented 8 years ago

Can one of you make a test case for this? An html file that uses the library where we can click on it and see what's supposed to happen.

SebT commented 8 years ago

I updated the OP's fiddle: http://jsfiddle.net/6bexbrwo/9/

And when you look at the source code of Notify.js, you notice here that the HTML container is never updated, only the text & classes.