基于jquery實(shí)現(xiàn)漂亮的動(dòng)態(tài)信息提示效果
簡(jiǎn)單,漂亮,動(dòng)畫(huà)效果,用戶體驗(yàn)好! 
這個(gè)效果是在頁(yè)面頭部出現(xiàn)的,出現(xiàn)一下會(huì)自動(dòng)隱藏,上面有x那個(gè)提示就要手動(dòng)關(guān)閉一下,其他的都是自動(dòng)隱藏的!
溫馨提示:基于jquery 1.6.2 版本!
<div id="message-dock">
<div id="message-sleeve" class="group">
<p><span class="sprite message-icon"></span><span id="message-text"></span><a class="dismiss"></a></p>
</div>
</div>
調(diào)用方式:
<script type="text/javascript" src="sysmsg.js"></script>
<script type="text/javascript">
ZENG.SysMsg.show('郵件格式錯(cuò)誤!', "error");
ZENG.SysMsg.show('請(qǐng)重新來(lái)過(guò)!', "alert");
ZENG.SysMsg.show('保存成功!');</script>
jquery版:
/*!
* jQuery JavaScript SysMsg v1.0
* http://zengxiangzhan.cnblogs.com/
* jQuery.sysmsg.js
* Copyright 2011, 曾祥展
* Date: 2011-8-1 20:00 2011 -2210
*/
if (!window.ZENG) var ZENG = {};
ZENG.add = function(d, f) {
var j;
if ($.isFunction(f.init)) {
j = f.init;
delete f.init;
$.extend(true, j.prototype, f);
this[d] = j
} else this[d] = f
};
ZENG.add("SysMsg", function() {
function d(u, D, v) {
D || (D = "success");
v = v || D == "error";
if (o) {
h.push(function() {
d(u, D)
});
f()
} else {
m.html(u);
i.removeClass().addClass(D).show().animate({
top: 0
}, 200, function() {
v || j()
});
o = 1
}
}
function f() {
i.animate({
top: "-50px"
}, 200, function() {
i.hide();
o = 0;
h.length && h.shift()()
})
}
function j() {
setTimeout(function() {
f()
}, 2E3)
}
var o, h = [],
i = $("#message-dock"),
m = i.find("#message-text");
$(".dismiss", "#message-dock").live("click", function(u) {
f();
u.preventDefault()
});
return {
show: d
}
}());
美觀樣式
.group {
display: block;
}
.group:after {
clear: both;
content: ".";
display: block;
height: 0;
visibility: hidden;
}
.group {
min-height: 1%;
}
* html .group {
height: 1%;
}
html, body, div,p{
background: none repeat scroll 0 0 transparent;
border: 0 none;
font-size: 100%;
margin: 0;
outline: 0 none;
vertical-align: baseline;
}
body {
color: #444444;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 75%;
line-height: 1;
}
#message-dock {
background-color: #164673;
color: #FFFFFF;
line-height: 1.75em;
padding: 10px;
position: fixed;
top: -60px;
width: 100%;
z-index: 9999;
}
#message-dock a {
color: #FFFFFF;
font-weight: bold;
text-decoration: underline;
}
#message-dock p {
border-radius: 5px 5px 5px 5px;
float: left;
padding: 5px 6px;
}
#message-dock .dismiss {
background: url("msg.png") repeat scroll -67px -180px #A12A2A;
border-radius: 0 5px 5px 0;
display: none;
float: left;
height: 21px;
padding-left: 10px;
text-indent: -999999px;
width: 20px;
cursor: pointer;
}
.sprite {
background: url("msg.png") no-repeat scroll 0 0 transparent;
display: inline-block;
vertical-align: top;
}
#message-sleeve {
margin: 0 auto;
max-width: 1200px;
min-width: 1000px;
}
.fixed #message-sleeve {
width: 1000px;
}
#message-text {
float: left;
font-size: 1.16667em;
padding: 0 10px 0 0;
}
.success p {
background-color: #7AA13D;
}
.alert p {
background-color: #FFF095;
color: #333333;
}
.alert a {
color: #333333 !important;
}
.error p {
background-color: #A12A2A;
padding-right: 0 !important;
}
.error #message-text {
padding-right: 0;
}
.error .dismiss {
display: block !important;
}
.error .message-icon, .alert .message-icon {
background-position: 0 -249px;
}
.message-icon {
background-position: -21px -249px;
float: left;
height: 21px;
margin-right: 6px;
position: relative;
width: 21px;
}
附件:
完畢!
- jquery提示效果實(shí)例分析
- jQuery提示效果代碼分享
- Jquery中國(guó)地圖熱點(diǎn)效果-鼠標(biāo)經(jīng)過(guò)彈出提示層信息的簡(jiǎn)單實(shí)例
- jquery實(shí)現(xiàn)非疊加式的搜索框提示效果
- jquery實(shí)現(xiàn)網(wǎng)站超鏈接和圖片提示效果
- jquery中dom操作和事件的實(shí)例學(xué)習(xí) 仿yahoo郵箱登錄框的提示效果
- 基于jquery的loading 加載提示效果實(shí)現(xiàn)代碼
- 基于JQuery 的消息提示框效果代碼
- Jquery實(shí)現(xiàn)地鐵線路指示燈提示牌效果的方法
相關(guān)文章
jQuery+Ajax請(qǐng)求本地?cái)?shù)據(jù)加載商品列表頁(yè)并跳轉(zhuǎn)詳情頁(yè)的實(shí)現(xiàn)方法
本文通過(guò)實(shí)例代碼給大家介紹了jQuery+Ajax請(qǐng)求本地?cái)?shù)據(jù)加載商品列表頁(yè)并跳轉(zhuǎn)詳情頁(yè),需要的朋友可以參考下2017-07-07
jQuery的animate函數(shù)學(xué)習(xí)記錄
jQuery.animate的每種動(dòng)畫(huà)過(guò)渡效果都是通過(guò)easing函數(shù)實(shí)現(xiàn)的,下面是自己研究之后對(duì)其的基本認(rèn)識(shí)2014-08-08
淺析JQuery UI Dialog的樣式設(shè)置問(wèn)題
本篇文章主要是對(duì)JQuery中UI Dialog的樣式設(shè)置問(wèn)題進(jìn)行了詳細(xì)的分析介紹,需要的朋友可以過(guò)來(lái)參考下,希望對(duì)大家有所幫助2013-12-12
jQuery.extend()、jQuery.fn.extend()擴(kuò)展方法示例詳解
這篇文章主要介紹了jQuery.extend()、jQuery.fn.extend()擴(kuò)展方法的應(yīng)用,需要的朋友可以參考下2014-05-05
JQuery簡(jiǎn)單實(shí)現(xiàn)錨點(diǎn)鏈接的平滑滾動(dòng)
在平時(shí)的項(xiàng)目中,我們經(jīng)常需要一些特效鏈接,如果使效果進(jìn)一步加強(qiáng),我們可以使點(diǎn)擊錨點(diǎn)鏈接平滑滾動(dòng)到錨點(diǎn),下面就來(lái)給大家講解下如何使用jQuery來(lái)實(shí)現(xiàn)。2015-05-05
jQuery學(xué)習(xí)筆記 更改jQuery對(duì)象
jQuery提供了一些方法,使流程變?yōu)樯蒵Query對(duì)象A,操作jQuery對(duì)象A;更改為jQuery對(duì)象B,操作jQuery對(duì)象B2012-09-09
JQuery操作Select的Options的Bug(IE8兼容性視圖模式)
JQuery在IE8兼容性視圖模式下操作Select的Options的Bug在本文進(jìn)行重現(xiàn)并給出詳細(xì)的解決方法,感興趣的朋友可以參考下哈,希望對(duì)你有所幫助2013-04-04

