热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

腾讯UED漂亮的提示信息效果代码_jquery

腾讯UED漂亮的提示信息效果代码,需要的朋友可以参考下。
腾讯UED 漂亮的提示信息

腾讯UED 漂亮的提示信息


CSS样式:

代码如下:


.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:54px;font-weight:bold;font-size:14px;color:#606060;background-image:url("gb_tip_layer.png");_background-image:url("gb_tip_layer_ie6.png");background-repeat:no-repeat;}
.zeng_msgbox_layer_wrap{width:100%;position:fixed;_position:absolute;top:46%;left:0;text-align:center;z-index:65533;}
.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:0;width:45px;position:absolute;}
.zeng_msgbox_layer .gtl_end{background-position:0 0;position:absolute;right:-6px;top:0;width:6px;}
.zeng_msgbox_layer .gtl_ico_fail{background-position:-6px -108px;position:absolute;left:-45px;top:0;width:45px;}
.zeng_msgbox_layer .gtl_ico_hits{background-position:-6px -54px;position:absolute;left:-45px;top:0;width:45px;}
.zeng_msgbox_layer .gtl_ico_clear{background-position:-6px 0;left:-5px;width:5px;position:absolute;top:0;}
.zeng_msgbox_layer img{float:left;margin:19px 10px 0 5px ;}


Javascript:

代码如下:


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 || "p"), 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_apos: /\x27/g,re_quot: /\x22/g},escString: {bsls: /\\/g,sls: /\//g,nl: /\n/g,rt: /\r/g,tab: /\t/g},restXHTML: {re_amp: /&/g,re_lt: //g,re_apos: /&(?:apos|#0?39);/g,re_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 = '', loading = '', 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("p", 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.show("设置成功!", 4, 2000);
ZENG.msgbox.show("服务器繁忙,请稍后再试。", 1, 2000);
ZENG.msgbox.show("数据拉取失败", 5, 2000);
ZENG.msgbox.show(" 正在加载中,请稍后...", 6,8000);


演示和下载体验: 腾讯UED-漂亮的提示信息
推荐阅读
  • 前言对于从事技术的人员来说ajax是这好东西,都会使用,而且乐于使用。但对于新手,开发一个ajax实例,还有是难度的,必竟对于他们这是新东西。leo开发一个简单的ajax实例,用的是 ... [详细]
  • 表单提交前的最后验证:通常在表单提交前,我们必须确认用户是否都把必须填选的做了,如果没有,就不能被提交到服务器,这里我们用到表单的formname.submit()看演示,其实这个对于我们修炼道 ... [详细]
  • VScode格式化文档换行或不换行的设置方法
    本文介绍了在VScode中设置格式化文档换行或不换行的方法,包括使用插件和修改settings.json文件的内容。详细步骤为:找到settings.json文件,将其中的代码替换为指定的代码。 ... [详细]
  • 本文介绍了使用AJAX的POST请求实现数据修改功能的方法。通过ajax-post技术,可以实现在输入某个id后,通过ajax技术调用post.jsp修改具有该id记录的姓名的值。文章还提到了AJAX的概念和作用,以及使用async参数和open()方法的注意事项。同时强调了不推荐使用async=false的情况,并解释了JavaScript等待服务器响应的机制。 ... [详细]
  • 本文讨论了Alink回归预测的不完善问题,指出目前主要针对Python做案例,对其他语言支持不足。同时介绍了pom.xml文件的基本结构和使用方法,以及Maven的相关知识。最后,对Alink回归预测的未来发展提出了期待。 ... [详细]
  • 在说Hibernate映射前,我们先来了解下对象关系映射ORM。ORM的实现思想就是将关系数据库中表的数据映射成对象,以对象的形式展现。这样开发人员就可以把对数据库的操作转化为对 ... [详细]
  • 本文介绍了在SpringBoot中集成thymeleaf前端模版的配置步骤,包括在application.properties配置文件中添加thymeleaf的配置信息,引入thymeleaf的jar包,以及创建PageController并添加index方法。 ... [详细]
  • 本文介绍了通过ABAP开发往外网发邮件的需求,并提供了配置和代码整理的资料。其中包括了配置SAP邮件服务器的步骤和ABAP写发送邮件代码的过程。通过RZ10配置参数和icm/server_port_1的设定,可以实现向Sap User和外部邮件发送邮件的功能。希望对需要的开发人员有帮助。摘要长度:184字。 ... [详细]
  • Java验证码——kaptcha的使用配置及样式
    本文介绍了如何使用kaptcha库来实现Java验证码的配置和样式设置,包括pom.xml的依赖配置和web.xml中servlet的配置。 ... [详细]
  • 本文介绍了使用cacti监控mssql 2005运行资源情况的操作步骤,包括安装必要的工具和驱动,测试mssql的连接,配置监控脚本等。通过php连接mssql来获取SQL 2005性能计算器的值,实现对mssql的监控。详细的操作步骤和代码请参考附件。 ... [详细]
  • iOS超签签名服务器搭建及其优劣势
    本文介绍了搭建iOS超签签名服务器的原因和优势,包括不掉签、用户可以直接安装不需要信任、体验好等。同时也提到了超签的劣势,即一个证书只能安装100个,成本较高。文章还详细介绍了超签的实现原理,包括用户请求服务器安装mobileconfig文件、服务器调用苹果接口添加udid等步骤。最后,还提到了生成mobileconfig文件和导出AppleWorldwideDeveloperRelationsCertificationAuthority证书的方法。 ... [详细]
  • 本文介绍了在开发Android新闻App时,搭建本地服务器的步骤。通过使用XAMPP软件,可以一键式搭建起开发环境,包括Apache、MySQL、PHP、PERL。在本地服务器上新建数据库和表,并设置相应的属性。最后,给出了创建new表的SQL语句。这个教程适合初学者参考。 ... [详细]
  • android listview OnItemClickListener失效原因
    最近在做listview时发现OnItemClickListener失效的问题,经过查找发现是因为button的原因。不仅listitem中存在button会影响OnItemClickListener事件的失效,还会导致单击后listview每个item的背景改变,使得item中的所有有关焦点的事件都失效。本文给出了一个范例来说明这种情况,并提供了解决方法。 ... [详细]
  • 本文介绍了使用PHP实现断点续传乱序合并文件的方法和源码。由于网络原因,文件需要分割成多个部分发送,因此无法按顺序接收。文章中提供了merge2.php的源码,通过使用shuffle函数打乱文件读取顺序,实现了乱序合并文件的功能。同时,还介绍了filesize、glob、unlink、fopen等相关函数的使用。阅读本文可以了解如何使用PHP实现断点续传乱序合并文件的具体步骤。 ... [详细]
  • Itwasworkingcorrectly,butyesterdayitstartedgiving401.IhavetriedwithGooglecontactsAPI ... [详细]
author-avatar
mobiledu2502857407
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有