ZENG.msgbox.show("设置成功!", 4, 2000);

ZENG.msgbox.show("服务器繁忙,请稍后再试。", 1, 2000);

ZENG.msgbox.show("数据拉取失败", 5, 2000);

ZENG.msgbox.show(" 正在加载中,请稍后...", 6,8000);

有4种提示效果,根据参数配置。

/*
 1、消息
 4、正确
 5、错误
 6、加载
*/

@charset "utf-8";
/* CSS Document */ .zeng_msgbox_layer,
.zeng_msgbox_layer .gtl_ico_succ,
.zeng_msgbox_layer .gtl_ico_fail,
.zeng_msgbox_layer .gtl_ico_hits,
.zeng_msgbox_layer .gtl_ico_clear,
.zeng_msgbox_layer .gtl_end{display:inline-block;height:54px;line-height:50px;font-weight:bold;font-size:14px;color:#000000;background-image:url("gb_tip_layer.png");background-repeat:no-repeat;}
.zeng_msgbox_layer_wrap{width:100%;position:fixed;_position:absolute;top:45%;left:;text-align:center;z-index:;}
.zeng_msgbox_layer{background-position:0 -161px;background-repeat:repeat-x;padding:0 18px 0 9px;margin:0 auto;position:relative;}
.zeng_msgbox_layer .gtl_ico_succ{background-position:-6px 0;left:-45px;top:;width:45px;position:absolute;}
.zeng_msgbox_layer .gtl_end{background-position:0 0;position:absolute;right:-6px;top:;width:6px;}
.zeng_msgbox_layer .gtl_ico_fail{background-position:-6px -108px;position:absolute;left:-45px;top:;width:45px;}
.zeng_msgbox_layer .gtl_ico_hits{background-position:-6px -54px;position:absolute;left:-45px;top:;width:45px;}
.zeng_msgbox_layer .gtl_ico_clear{background-position:-6px 0;left:-5px;width:5px;position:absolute;top:;}
.zeng_msgbox_layer img{float:left;margin:19px 10px 0 5px ;}
window.ZENG=window.ZENG || {};

ZENG.dom = {getById: function(id) {
return document.getElementById(id);
},get: function(e) {
return (typeof (e) == "string") ? document.getElementById(e) : e;
},createElementIn: function(tagName, elem, insertFirst, attrs) {
var _e = (elem = ZENG.dom.get(elem) || document.body).ownerDocument.createElement(tagName || "div"), k;
if (typeof (attrs) == 'object') {
for (k in attrs) {
if (k == "class") {
_e.className = attrs[k];
} else if (k == "style") {
_e.style.cssText = attrs[k];
} else {
_e[k] = attrs[k];
}
}
}
insertFirst ? elem.insertBefore(_e, elem.firstChild) : elem.appendChild(_e);
return _e;
},getStyle: function(el, property) {
el = ZENG.dom.get(el);
if (!el || el.nodeType == 9) {
return null;
}
var w3cMode = document.defaultView && document.defaultView.getComputedStyle, computed = !w3cMode ? null : document.defaultView.getComputedStyle(el, ''), value = "";
switch (property) {
case "float":
property = w3cMode ? "cssFloat" : "styleFloat";
break;
case "opacity":
if (!w3cMode) {
var val = 100;
try {
val = el.filters['DXImageTransform.Microsoft.Alpha'].opacity;
} catch (e) {
try {
val = el.filters('alpha').opacity;
} catch (e) {
}
}
return val / 100;
} else {
return parseFloat((computed || el.style)[property]);
}
break;
case "backgroundPositionX":
if (w3cMode) {
property = "backgroundPosition";
return ((computed || el.style)[property]).split(" ")[0];
}
break;
case "backgroundPositionY":
if (w3cMode) {
property = "backgroundPosition";
return ((computed || el.style)[property]).split(" ")[1];
}
break;
}
if (w3cMode) {
return (computed || el.style)[property];
} else {
return (el.currentStyle[property] || el.style[property]);
}
},setStyle: function(el, properties, value) {
if (!(el = ZENG.dom.get(el)) || el.nodeType != 1) {
return false;
}
var tmp, bRtn = true, w3cMode = (tmp = document.defaultView) && tmp.getComputedStyle, rexclude = /z-?index|font-?weight|opacity|zoom|line-?height/i;
if (typeof (properties) == 'string') {
tmp = properties;
properties = {};
properties[tmp] = value;
}
for (var prop in properties) {
value = properties[prop];
if (prop == 'float') {
prop = w3cMode ? "cssFloat" : "styleFloat";
} else if (prop == 'opacity') {
if (!w3cMode) {
prop = 'filter';
value = value >= 1 ? '' : ('alpha(opacity=' + Math.round(value * 100) + ')');
}
} else if (prop == 'backgroundPositionX' || prop == 'backgroundPositionY') {
tmp = prop.slice(-1) == 'X' ? 'Y' : 'X';
if (w3cMode) {
var v = ZENG.dom.getStyle(el, "backgroundPosition" + tmp);
prop = 'backgroundPosition';
typeof (value) == 'number' && (value = value + 'px');
value = tmp == 'Y' ? (value + " " + (v || "top")) : ((v || 'left') + " " + value);
}
}
if (typeof el.style[prop] != "undefined") {
el.style[prop] = value + (typeof value === "number" && !rexclude.test(prop) ? 'px' : '');
bRtn = bRtn && true;
} else {
bRtn = bRtn && false;
}
}
return bRtn;
},getScrollTop: function(doc) {
var _doc = doc || document;
return Math.max(_doc.documentElement.scrollTop, _doc.body.scrollTop);
},getClientHeight: function(doc) {
var _doc = doc || document;
return _doc.compatMode == "CSS1Compat" ? _doc.documentElement.clientHeight : _doc.body.clientHeight;
}
}; ZENG.string = {RegExps: {trim: /^\s+|\s+$/g,ltrim: /^\s+/,rtrim: /\s+$/,nl2br: /\n/g,s2nb: /[\x20]{2}/g,URIencode: /[\x09\x0A\x0D\x20\x21-\x29\x2B\x2C\x2F\x3A-\x3F\x5B-\x5E\x60\x7B-\x7E]/g,escHTML: {re_amp: /&/g,re_lt: /</g,re_gt: />/g,re_apos: /\x27/g,re_quot: /\x22/g},escString: {bsls: /\\/g,sls: /\//g,nl: /\n/g,rt: /\r/g,tab: /\t/g},restXHTML: {re_amp: /&amp;/g,re_lt: /&lt;/g,re_gt: /&gt;/g,re_apos: /&(?:apos|#0?39);/g,re_quot: /&quot;/g},write: /\{(\d{1,2})(?:\:([xodQqb]))?\}/g,isURL: /^(?:ht|f)tp(?:s)?\:\/\/(?:[\w\-\.]+)\.\w+/i,cut: /[\x00-\xFF]/,getRealLen: {r0: /[^\x00-\xFF]/g,r1: /[\x00-\xFF]/g},format: /\{([\d\w\.]+)\}/g},commonReplace: function(s, p, r) {
return s.replace(p, r);
},format: function(str) {
var args = Array.prototype.slice.call(arguments), v;
str = String(args.shift());
if (args.length == 1 && typeof (args[0]) == 'object') {
args = args[0];
}
ZENG.string.RegExps.format.lastIndex = 0;
return str.replace(ZENG.string.RegExps.format, function(m, n) {
v = ZENG.object.route(args, n);
return v === undefined ? m : v;
});
}}; ZENG.object = {
routeRE: /([\d\w_]+)/g,
route: function(obj, path) {
obj = obj || {};
path = String(path);
var r = ZENG.object.routeRE, m;
r.lastIndex = 0;
while ((m = r.exec(path)) !== null) {
obj = obj[m[0]];
if (obj === undefined || obj === null) {
break;
}
}
return obj;
}}; var ua = ZENG.userAgent = {}, agent = navigator.userAgent;
ua.ie = 9 - ((agent.indexOf('Trident/5.0') > -1) ? 0 : 1) - (window.XDomainRequest ? 0 : 1) - (window.XMLHttpRequest ? 0 : 1); if (typeof (ZENG.msgbox) == 'undefined') {
ZENG.msgbox = {};
}
ZENG.msgbox._timer = null;
ZENG.msgbox.loadingAnimationPath = ZENG.msgbox.loadingAnimationPath || ("loading.gif");
ZENG.msgbox.show = function(msgHtml, type, timeout, opts) {
if (typeof (opts) == 'number') {
opts = {topPosition: opts};
}
opts = opts || {};
var _s = ZENG.msgbox,
template = '<span class="zeng_msgbox_layer" style="display:none;z-index:10000;" id="mode_tips_v2"><span class="gtl_ico_{type}"></span>{loadIcon}{msgHtml}<span class="gtl_end"></span></span>', loading = '<img src="' + (opts.customIcon || _s.loadingAnimationPath) + '" alt="" />', typeClass = [0, 0, 0, 0, "succ", "fail", "clear"], mBox, tips;
_s._loadCss && _s._loadCss(opts.cssPath);
mBox = ZENG.dom.get("q_Msgbox") || ZENG.dom.createElementIn("div", document.body, false, {className: "zeng_msgbox_layer_wrap"});
mBox.id = "q_Msgbox";
mBox.style.display = "";
mBox.innerHTML = ZENG.string.format(template, {type: typeClass[type] || "hits",msgHtml: msgHtml || "",loadIcon: type == 6 ? loading : ""});
_s._setPosition(mBox, timeout, opts.topPosition);
};
ZENG.msgbox._setPosition = function(tips, timeout, topPosition) {
timeout = timeout || 5000;
var _s = ZENG.msgbox, bt = ZENG.dom.getScrollTop(), ch = ZENG.dom.getClientHeight(), t = Math.floor(ch / 2) - 40;
ZENG.dom.setStyle(tips, "top", ((document.compatMode == "BackCompat" || ZENG.userAgent.ie < 7) ? bt : 0) + ((typeof (topPosition) == "number") ? topPosition : t) + "px");
clearTimeout(_s._timer);
tips.firstChild.style.display = "";
timeout && (_s._timer = setTimeout(_s.hide, timeout));
};
ZENG.msgbox.hide = function(timeout) {
var _s = ZENG.msgbox;
if (timeout) {
clearTimeout(_s._timer);
_s._timer = setTimeout(_s._hide, timeout);
} else {
_s._hide();
}
};
ZENG.msgbox._hide = function() {
var _mBox = ZENG.dom.get("q_Msgbox"), _s = ZENG.msgbox;
clearTimeout(_s._timer);
if (_mBox) {
var _tips = _mBox.firstChild;
ZENG.dom.setStyle(_mBox, "display", "none");
}
};

ZENG msgbox仿qq提示的更多相关文章

  1. 【WP8】仿QQ提示消息

    WP版的QQ提示消息的时候从顶部滑入,3秒后从顶部滑出,本文模仿该效果实现一个MessageToastManager类用于显示提示消息 思路很简单,就是动画而已,支持配置颜色和回掉 // ****** ...

  2. jquery-模仿qq提示消息

    ( function() { var ua = navigator.userAgent.toLowerCase(); var is = (ua.match(/\b(chrome|opera|safar ...

  3. wpf实现仿qq消息提示框

    原文:wpf实现仿qq消息提示框 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/huangli321456/article/details/5052 ...

  4. Socket实现仿QQ聊天(可部署于广域网)附源码(1)-简介

    1.前言 本次实现的这个聊天工具是我去年c#程序设计课程所写的Socket仿QQ聊天,由于当时候没有自己的服务器,只能在机房局域网内进行测试,最近在腾讯云上买了一台云主机(本人学生党,腾讯云有个学生专 ...

  5. 高仿QQ即时聊天软件开发系列之三登录窗口用户选择下拉框

    上一篇高仿QQ即时聊天软件开发系列之二登录窗口界面写了一个大概的布局和原理 这一篇详细说下拉框的实现原理 先上最终效果图 一开始其实只是想给下拉框加一个placeholder效果,让下拉框在未选择未输 ...

  6. 自定义仿 QQ 健康计步器进度条

    自定义仿 QQ 健康计步器进度条 版权声明:本文为博主原创文章,未经博主允许不得转载. 微博:厉圣杰 源码:CircleProgress 文中如有纰漏,欢迎大家留言指出. 闲着没事,趁上班时间偷偷撸了 ...

  7. Android高仿qq及微信底部菜单的几种实现方式

    最近项目没那么忙,想着开发app的话,有很多都是重复,既然是重复的,那就没有必要每次都去写,所以就想着写一个app通用的基本框架,这里说的框架不是什么MVC,MVP,MVVM这种,而是app开发的通用 ...

  8. WPF C#截图功能 仿qq截图

    原文:WPF C#截图功能 仿qq截图 先上效果图 源码下载地址:http://download.csdn.net/detail/candyvoice/9788099 描述:启动程序,点击窗口butt ...

  9. 基于jQuery仿QQ音乐播放器网页版代码

    基于jQuery仿QQ音乐播放器网页版代码是一款黑色样式风格的网页QQ音乐播放器样式代码.效果图如下: 在线预览   源码下载 实现的代码. html代码: <div class="m ...

随机推荐

  1. Sublime 不自动打开上次未关闭的文件 设置方法

    { "font_size": 17, "hot_exit": false, "remember_open_files": false, &q ...

  2. .NET: WPF Data Binding

    WPF是分离UI和Logic的最佳工具,不同于Window Form的事件驱动原理,WPF采用的是数据驱动,让UI成为了Logic的附属,达到分离的效果. 本篇主要讲讲wpf的精华:data bind ...

  3. SQL中索引的原理

    (一)深入浅出理解索引结构         实际上,您可以把索引理解为一种特殊的目录.微软的SQL   SERVER提供了两种索引:聚集索引(clustered   index,也称聚类索引.簇集索引 ...

  4. yii遍历行下的每列数据(小1月考)

    效果图: 控制器(1种): //显示列表    public function actionList()    {        //实例化对象        $model= new Qiu();   ...

  5. ligerui_ligerTree_003_配置url参数,加载“树”

    配置url参数,加载“树”: 源码下载地址:http://download.csdn.net/detail/poiuy1991719/8571255 效果图:json.txt HTML代码: < ...

  6. ios 开源代码

    .开源代码 http://www.oschina.net/iOS/codingList/365/ios-button http://www.devdiv.com/iOS_iPhone-iOS6%E6% ...

  7. paper 86:行人检测资源(上)综述文献【转载,以后使用】

    行人检测具有极其广泛的应用:智能辅助驾驶,智能监控,行人分析以及智能机器人等领域.从2005年以来行人检测进入了一个快速的发展阶段,但是也存在很多问题还有待解决,主要还是在性能和速度方面还不能达到一个 ...

  8. sql server 查看数据库编码格式

    user masterselect SERVERPROPERTY(N'edition') as Edition --数据版本,如企业版.开发版等,SERVERPROPERTY(N'collation' ...

  9. DB2 Unload 的时候遇到B37-04

    B37-04的问题是每个Mainframer首先会遇到的问题,在Unload的时候最大的可能性是Extend次数到16次了,这时候只要加大primary或secondary就可以了,我最常用的是pri ...

  10. 重要的事情说三遍:列表 ul / ol 等是块级元素,是块级元素,块级元素

    HTML 块级元素 大多数 HTML 元素被定义为块级元素或内联元素. 编者注:“块级元素”译为 block level element,“行内元素”译为 inline element. 块级元素在浏 ...