condpattern,
(function() {
var bttn = document.getElementsByClassName('progress-button');
for (var i = 0; i < bttn.length; i++) {
(function(k) {
// make sure..
bttn[k].disabled = false;
bttn[k].addEventListener('click', function() {
// simulate loading (for demo purposes only)
classie.add(bttn[k], 'active');
setTimeout(function() {
classie.remove(bttn[k], 'active');
// create the notification
var notification = new NotificationFx({
message: '<span class="icon icon-megaphone"></span><p>You have some interesting news in your inbox. Go <a href="#">check it out</a> now.</p>',
layout: 'bar',
effect: 'slidetop',
type: 'notice', // notice, warning or error
onClose: function() {
bttn[k].disabled = false;
}
});
// show the notification
notification.show();
}, 1200);
// disable the button (for demo purposes only)
this.disabled = true;
});
})(i);
}
})();
|