<div id="msg_win" style="display: block; top: 490px; visibility: visible; opacity: 1;">
<div class="icos"><a id="msg_min" title="" href="javascript:void 0"></a><a id="msg_close" title="关闭" href="javascript:void 0">×</a></div>
<div id="msg_title">您有新文件</div>
<audio controls="controls" autoplay="autoplay">
<source src="~/Content/MP3/Message.mp3" type="audio/mpeg" />
</audio>
<div id="msg_content"></div>
</div>

<style type="text/css">
#msg_win {
border: 1px solid #A67901;
background: #EAEAEA;
width: 180px;
position: absolute;
right: 0;
font-size: 12px;
font-family: Arial;
margin: 0px;
display: none;
overflow: hidden;
z-index: 99;
}

#msg_win .icos {
position: absolute;
top: 2px;
*top: 0px;
right: 2px;
z-index: 9;
}

.icos a {
float: left;
color: #833B02;
margin: 1px;
text-align: center;
font-weight: bold;
width: 14px;
height: 22px;
line-height: 22px;
padding: 1px;
text-decoration: none;
font-family: webdings;
}

.icos a:hover {
color: #fff;
}

#msg_title {
background: #FECD00;
border-bottom: 1px solid #A67901;
border-top: 1px solid #FFF;
border-left: 1px solid #FFF;
color: #000;
height: 25px;
line-height: 25px;
text-indent: 5px;
}

#msg_content {
margin: 5px;
margin-right: 0;
width: 230px;
height: auto;
overflow: visible;
}
</style>
<!-- 弹窗样式 -->
<script type="text/javascript">
//function getleader() {
// $.getJSON("/homepage/getleader", {}, function (data) {
// $("#leader").html(data);
// })
//}
//function getpop() {
// $.getJSON("/homepage/Getpop", {}, function (data) {
// $("#msg_content").html(data);
// });
//}
var Message = {
//set: function () {//最小化与恢复状态切换
// var set = this.minbtn.status == 1 ? [0, 1, 'block', this.char[0], '最小化'] : [1, 0, 'none', this.char[1], '展开'];
// this.minbtn.status = set[0];
// this.win.style.borderBottomWidth = set[1];
// this.content.style.display = set[2];
// this.minbtn.innerHTML = set[3]
// this.minbtn.title = set[4];
// this.win.style.top = this.getY().top;
//},
close: function () {//关闭
this.win.style.display = 'none';
window.onscroll = null;
},
setOpacity: function (x) {//设置透明度
var v = x >= 100 ? '' : 'Alpha(opacity=' + x + ')';
this.win.style.visibility = x <= 0 ? 'hidden' : 'visible'; //IE有绝对或相对定位内容不随父透明度变化的bug
this.win.style.filter = v;
this.win.style.opacity = x / 100;
},
show: function () {//渐显
clearInterval(this.timer2);
var me = this, fx = this.fx(0, 100, 0.1), t = 0;
this.timer2 = setInterval(function () {
t = fx();
me.setOpacity(t[0]);
if (t[1] == 0) { clearInterval(me.timer2) }
}, 10);
},
fx: function (a, b, c) {//缓冲计算
var cMath = Math[(a - b) > 0 ? "floor" : "ceil"], c = c || 0.1;
return function () { return [a += cMath((b - a) * c), a - b] }
},
getY: function () {//计算移动坐标
var d = document, b = document.body, e = document.documentElement;
var s = Math.max(b.scrollTop, e.scrollTop);
var h = /BackCompat/i.test(document.compatMode) ? b.clientHeight : e.clientHeight;
var h2 = this.win.offsetHeight;
return { foot: s + h + h2 + 2 + 'px', top: s + h - h2 - 2 + 'px' }
},
moveTo: function (y) {//移动动画
clearInterval(this.timer);
var me = this, a = parseInt(this.win.style.top) || 0;
var fx = this.fx(a, parseInt(y));
var t = 0;
this.timer = setInterval(function () {
t = fx();
me.win.style.top = t[0] + 'px';
if (t[1] == 0) {
clearInterval(me.timer);
me.bind();
}
}, 10);
},
bind: function () {//绑定窗口滚动条与大小变化事件
var me = this, st, rt;
window.onscroll = function () {
clearTimeout(st);
clearTimeout(me.timer2);
me.setOpacity(0);
st = setTimeout(function () {
me.win.style.top = me.getY().top;
me.show();
}, 600);
};
window.onresize = function () {
clearTimeout(rt);
rt = setTimeout(function () { me.win.style.top = me.getY().top }, 100);
}
},
init: function () {//创建HTML
function $(id) { return document.getElementById(id) };
this.win = $('msg_win');
var set = { minbtn: 'msg_min', closebtn: 'msg_close', title: 'msg_title', content: 'msg_content' };
for (var Id in set) { this[Id] = $(set[Id]) };
var me = this;
this.minbtn.onclick = function () { me.set(); this.blur() };
this.closebtn.onclick = function () { me.close() };
this.char = navigator.userAgent.toLowerCase().indexOf('firefox') + 1 ? ['_', '::', '×'] : ['0', '2', 'r']; //FF不支持webdings字体
this.minbtn.innerHTML = this.char[0];
this.closebtn.innerHTML = this.char[2];
setTimeout(function () {//初始化最先位置
me.win.style.display = 'block';
me.win.style.top = me.getY().foot;
me.moveTo(me.getY().top);
}, 0);
return this;
}
};
Message.init();
</script>

JS 弹窗到右下角的更多相关文章

  1. cefsharp重写默认js弹窗(alert/confirm/prompt)

    1.设置js弹窗控制器 webView.JsDialogHandler = this;  //js弹窗控制 this表示本类对象,所以本类要实现IJsDialogHandler接口 2.实现IJsDi ...

  2. js弹窗

    常用人JS弹窗,lhgDialog 4.20

  3. js弹窗登录效果(源码)--web前端

    1.JS弹窗登录效果 <!DOCTYPE html><html lang="en"><head> <meta charset=" ...

  4. 一行js弹窗代码就能设计漂亮的弹窗广告

    接到一个设计需求,要求xmyanke在网站右侧挂一个弹窗广告宣传最近的活动,找了半天都没看到合适的,自己鼓捣了一行js弹窗代码就能设计漂亮的弹窗广告,来瞧一下,欢迎拍砖提意见,js弹窗广告代码如下: ...

  5. js弹窗 js弹出DIV,并使整个页面背景变暗

    1.首先写一个遮罩层div,然后再写一个弹窗的div <!-- 遮罩层 --> <div id="cover" style="background: # ...

  6. (转)js弹窗&返回值(window.open方式)

    本文转载自:http://hi.baidu.com/z57354658/item/5d5e26b8e9f42fa7ebba93d4 js弹窗&返回值(window.open方式) test.h ...

  7. asp.net 后台使用js弹窗失效问题

    1.这些事件输出来前后都变成JS代码了,看到到这样的代码的了.会变成<script>alert('合同号XXX已存在')</script>首先后台调试一下看看Page.Clie ...

  8. JS弹窗带遮蔽的功能

    很不错的JS原生自定义弹窗,很实用! function myAlert(str,click,useCancel){ var overflow=""; var $hidder=nul ...

  9. js 弹窗的实现

    原理: 1. 点击按钮,触发窗口显示,遮罩层显示,并设置窗口的位置 2. 为弹出的窗口绑定鼠标滚动事件和视窗改变事件 3.点击关闭按钮,弹窗消失,遮罩层消失 html 代码: <!DOCTYPE ...

随机推荐

  1. nginx集群报错“upstream”directive is not allow here 错误

    nginx集群报错“upstream”directive is not allow here 错误 搭建了一个服务器, 采用的是nginx + apache(多个) + php + mysql(两个) ...

  2. AFNetworking 与 UIKit+AFNetworking 详解

    资料来源 : http://github.ibireme.com/github/list/ios GitHub : 链接地址 简介 : A delightful iOS and OS X networ ...

  3. iOS多线程开发

    概览 大家都知道,在开发过程中应该尽可能减少用户等待时间,让程序尽可能快的完成运算.可是无论是哪种语言开发的程序最终往往转换成汇编语言进而解释成机器码来执行.但是机器码是按顺序执行的,一个复杂的多步操 ...

  4. Location of several networks in brain

    Source: Naci, L., et al. (2014). "A common neural code for similar conscious experiences in dif ...

  5. xenserver磁盘扩容扩不大问题解决

    http://www.osyunwei.com/archives/7956.html xenserver将磁盘扩大后,fdisk可以看到容量大了 但是df -h确实没大?   解决: fdisk /d ...

  6. Shell高级编程视频教程-跟着老男孩一步步学习Shell高级编程实战视频教程

    Shell高级编程视频教程-跟着老男孩一步步学习Shell高级编程实战视频教程 教程简介: 本教程共71节,主要介绍了shell的相关知识教程,如shell编程需要的基础知识储备.shell脚本概念介 ...

  7. [MetaHook] GameUI hook

    Hook GameUI function. #include <metahook.h> #include <IGameUI.h> IGameUI *g_pGameUI = ; ...

  8. 2015-2016-2 《Java程序设计》教学进程

    2015-2016-2 <Java程序设计>教学进程 目录 考核方式 寒假准备 教学进程 第00周学习任务和要求 第01周学习任务和要求 第02周学习任务和要求 第03周学习任务和要求 第 ...

  9. 流形学习之等距特征映射(Isomap)

    感觉是有很久没有回到博客园,发现自己辛苦写的博客都被别人不加转载的复制粘贴过去真的心塞,不过乐观如我,说明做了一点点东西,不至于太蠢,能帮人最好.回校做毕设,专心研究多流形学习方法,生出了考研的决心. ...

  10. 使用pngquant来压缩png资源缩小apk

    最近发现了一个叫做pngquant的工具,可以有效的压缩资源文件中的png文件,从而减小发布的apk的大小.我发现这个工具有两个特点: 1. 真无损,压缩后重新运行了我的app发现是没有任何区别的 2 ...