做网站|网站建设,就上易助科技网

前端技术文档及相关资料下载

关于前端html、css、js等技术上的各种疑难棘手问题的解决方案探讨及相关资料下载!

JQuery高度可定制消息通知插件Notify.js
来源:易助科技网浏览量:3收藏

简介

Notify.js是一款JQuery高度可定制消息通知插件,使用简单方便,可以设置任意的元素内显示消息提示。

 


(下载的附件中附有DEMO)


使用

1.  引入文件

<script src="jquery.js"></script>
<script src="notify.js"></script>


2.  HTML

<div class="boxes"></div>

//CSS

<style type="text/css">
html {
font-family: Helvetica;
}

.boxes {
margin: 150px;
}
.box {
border: thin solid blue;
padding: 10px;
margin: 20px;
width: 100px;
}
.wrapper {
margin-top: 50px
}
</style>


3.  调用

<script class="demo">

$.notify.defaults({
autoHide: false
});

var classes = ["error", "success", "warn", "info"];
var boxes = $(".boxes");

$.each(classes, function(i, c) {
var box = $("<div class=\"box\">"+c+"</div>");
boxes.append($("<div class=\"wrapper\"/>").append(box));

setTimeout(function() {
box.notify(c, {className: c});
}, 500)
});
</script>


相关链接

GitHub 地址 :https://github.com/jpillora/notifyjs