jquery-模仿qq提示消息
( function() {
var ua = navigator.userAgent.toLowerCase();
var is = (ua.match(/\b(chrome|opera|safari|msie|firefox)\b/) || [ '',
'mozilla' ])[1];
var r = '(?:' + is + '|version)[\\/: ]([\\d.]+)';
var v = (ua.match(new RegExp(r)) || [])[1];
jQuery.browser.is = is;
jQuery.browser.ver = v;
jQuery.browser[is] = true;
})();
( function(jQuery) {
/*
*
* jQuery Plugin - Messager
*
* Author: corrie Mail: corrie@sina.com Homepage: www.corrie.net.cn
*
* Copyright (c) 2008 corrie.net.cn
*
* @license http://www.gnu.org/licenses/gpl.html [GNU General Public
* License]
*
*
*
* $Date: 2008-12-26
*
* $Vesion: 1.5 @ how to use and example: Please Open index.html
*
*/
this.version = '@1.5';
this.layer = {
'width' :200,
'height' :100
};
this.title = '信息提示';
this.time = 4000;
this.anims = {
'type' :'slide',
'speed' :600
};
this.timer1 = null;
this.inits = function(title, text) {
if ($("#message").is("div")) {
return;
}
$(document.body)
.prepend(
'<div id="message" style="border:#b9c9ef 1px solid;z-index:100;width:'
+ this.layer.width
+ 'px;height:'
+ this.layer.height
+ 'px;position:absolute; display:none;background:#cfdef4; bottom:0; right:0; overflow:hidden;"><div style="border:1px solid #fff;border-bottom:none;width:100%;height:25px;font-size:12px;overflow:hidden;color:#1f336b;"><span id="message_close" style="float:right;padding:5px 0 5px 0;width:16px;line-height:auto;color:red;font-size:12px;font-weight:bold;text-align:center;cursor:pointer;overflow:hidden;">×</span><div style="padding:5px 0 5px 5px;width:100px;line-height:18px;text-align:left;overflow:hidden;">'
+ title
+ '</div><div style="clear:both;"></div></div> <div style="padding-bottom:5px;border:1px solid #fff;border-top:none;width:100%;height:auto;font-size:12px;"><div id="message_content" style="margin:0 5px 0 5px;border:#b9c9ef 1px solid;padding:10px 0 10px 5px;font-size:12px;width:'
+ (this.layer.width - 17)
+ 'px;height:'
+ (this.layer.height - 50)
+ 'px;color:#1f336b;text-align:left;overflow:hidden;">'
+ text + '</div></div></div>');
$("#message_close").click( function() {
setTimeout('this.close()', 1);
});
$("#message").hover( function() {
clearTimeout(timer1);
timer1 = null;
}, function() {
if (time > 0)
timer1 = setTimeout('this.close()', time);
});
$(window).scroll(
function() {
var bottomHeight = "-"+document.documentElement.scrollTop;
$("#message").css("bottom", bottomHeight + "px");
});
};
this.show = function(title, text, time) {
if ($("#message").is("div")) {
return;
}
if (title == 0 || !title)
title = this.title;
this.inits(title, text);
if (time >= 0)
this.time = time;
switch (this.anims.type) {
case 'slide':
$("#message").slideDown(this.anims.speed);
break;
case 'fade':
$("#message").fadeIn(this.anims.speed);
break;
case 'show':
$("#message").show(this.anims.speed);
break;
default:
$("#message").slideDown(this.anims.speed);
break;
}
var bottomHeight = "-"+document.documentElement.scrollTop;
$("#message").css("bottom", bottomHeight + "px");
if ($.browser.is == 'chrome') {
setTimeout( function() {
$("#message").remove();
this.inits(title, text);
$("#message").css("display", "block");
}, this.anims.speed - (this.anims.speed / 5));
}
this.rmmessage(this.time);
};
this.lays = function(width, height) {
if ($("#message").is("div")) {
return;
}
if (width != 0 && width)
this.layer.width = width;
if (height != 0 && height)
this.layer.height = height;
}
this.anim = function(type, speed) {
if ($("#message").is("div")) {
return;
}
if (type != 0 && type)
this.anims.type = type;
if (speed != 0 && speed) {
switch (speed) {
case 'slow':
;
break;
case 'fast':
this.anims.speed = 200;
break;
case 'normal':
this.anims.speed = 400;
break;
default:
this.anims.speed = speed;
}
}
}
this.rmmessage = function(time) {
if (time > 0) {
timer1 = setTimeout('this.close()', time);
}
};
this.close = function() {
switch (this.anims.type) {
case 'slide':
$("#message").slideUp(this.anims.speed);
break;
case 'fade':
$("#message").fadeOut(this.anims.speed);
break;
case 'show':
$("#message").hide(this.anims.speed);
break;
default:
$("#message").slideUp(this.anims.speed);
break;
}
;
setTimeout('$("#message").remove();', this.anims.speed);
this.original();
}
this.original = function() {
this.layer = {
'width' :200,
'height' :100
};
this.title = '信息提示';
this.time = 4000;
this.anims = {
'type' :'slide',
'speed' :600
};
};
jQuery.messager = this;
return jQuery;
})(jQuery);
jquery-模仿qq提示消息的更多相关文章
- 【WP8】仿QQ提示消息
WP版的QQ提示消息的时候从顶部滑入,3秒后从顶部滑出,本文模仿该效果实现一个MessageToastManager类用于显示提示消息 思路很简单,就是动画而已,支持配置颜色和回掉 // ****** ...
- jQuery动态提示消息框效果
效果预览:http://keleyi.com/keleyi/phtml/jqtexiao/2.htm 原文:http://keleyi.com/a/bjac/hxv86dyi.htm <!DOC ...
- jQuery实现鼠标移到元素上动态提示消息框效果
当光标移动到某些元素上时,会弹出像tips的提示框,这种效果想必大家都有见到过吧,下面有个不错的示例,大家可以感受下 当光标移动到某些元素上时,会弹出像tips的提示框. 复制代码代码如下: < ...
- Jquery 网站保存信息提示消息实现,提示后自动消失
现在的大多数网站都有校验,以及信息提示:为了给用户更好的体验可以不用alert提示消息,采用jQuery提示完消息,自动消失 css <style> #tip_message { z-in ...
- 一款基于jquery超炫的弹出层提示消息
今天给大家带来一款基于jquery超炫的弹出层提示消息.这款实例页面初始时,一个go按钮.当单击go按钮时,提示强出层以动画形式出现.效果图如下: 在线预览 源码下载 实现的代码. html代码: ...
- jquery提示消息,简单通用
jquery提示消息.简单通用 function showTips(txt,time,status) { var htmlCon = ''; if(txt != ''){ if(status != 0 ...
- jquery easyui 弹出消息框 (转载) jQuery EasyUI API 中文文档 - 消息框(Messager) http://www.cnblogs.com/hantianwei/archive/2012/03/19/2407113.html
<html> <head> <!-- 导入easyui插件的js和css样式; --> <link rel="stylesheet" ty ...
- jquery easyui 弹出消息框
<html> <head> <!-- 导入easyui插件的js和css样式; --> <link rel="stylesheet" ty ...
- 关于 使用python向qq好友发送消息(对爬虫的作用----当程序执行完毕或者报错无限给自己qq发送消息,直到关闭)
以前看到网上一些小程序,在处理完事物后会自动发送qq消息,但是一直搞不懂是说明原理.也在网上找过一些python登陆qq发送消息的文字,但是都太复杂了.今天偶然看到一篇文章,是用python调用win ...
随机推荐
- 快速创建 HTML5 Canvas 电信网络拓扑图
前言 属性列表想必大家都不会陌生,正常用 HTML5 来做的属性列表大概就是用下拉菜单之类的,而且很多情况下,下拉列表还不够好看,怎么办?我试着用 HT for Web 来实现属性栏点击按钮弹出多功能 ...
- READ TABLE 的用法
SORT ITAB BY '你想比较的列'. " 排序以增加二分查找的速度 READ TABLE itab with key 'itab中某列' = ‘目标列' BINARY SEARCH. ...
- Path通过Selenium模拟浏览器抓取,Windows 64解决selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.方法
1.下载geckodriver.exe: 下载地址:https://github.com/mozilla/geckodriver/releases请根据系统版本选择下载:(如Windows 64位系统 ...
- JavaScript对象入门指南
前言 不少开发对JavaScript实现面向对象编程存在一知半解,并且不少的在项目实践中写的都是面向过程编程的代码,因此,希望能从零入手介绍面向对象的一些概念到实现简单的面向对象的例子让大家包括我自己 ...
- 误删 /user/bin目录后的补救
当危险的动作发生, 误删 /user/bin目录后的补救 以下是昨天晚上真实的误操作现场,模拟记录一下 (这是测试环境,所以操作得很随意,有些执行动作很不规范) 在上面编译一个软件Dboop,完事以后 ...
- Servlet的三个域对象
我们在开发javaweb项目的时候,经常会遇到jsp和Servet之间互相传值,既然有传值,就要有对象来传,这里先说Servlet的三大域对象,request,session,application他 ...
- 【Python】 命名空间与LEGB规则
命名空间与LEGB规则 之前隐隐约约提到过一些关于Python赋值语句的特殊性的问题,这个问题的根源就在于Python中的变量的命名空间机制和之前熟悉的C也好java也好都不太一样. ■ 命名空间 所 ...
- Matlab绘图基础——绘制向量图,二维三维(绘制参数曲线图)
------------------------------------------- %绘制向量场图 %例一 clear all;clc; [X,Y] = meshgrid(-2:.2:2,-3:. ...
- [poj3904]Sky Code_状态压缩_容斥原理
Sky Code poj-3904 题目大意:给你n个数,问能选出多少满足题意的组数. 注释:如果一个组数满足题意当且仅当这个组中有且只有4个数,且这4个数的最大公约数是1,$1\le n\le 10 ...
- Mysql 一次性备份导出/导入恢复所有数据库
有木有遇到过这种情况?电脑或者服务器需要重装系统?可是你电脑上存着n多个网站的数据库,怎么办?把数据库文件夹拷贝出来,重装系统之后再拷回去?如果你使用了InnoDB引擎,恐怕那样做会出麻烦的,一个一个 ...