<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. 嵌入式Linux驱动学习之路(九)Linux系统调用、驱动程序框架

    应用程序通过open  read  write close 等函数来操作计算机硬件.类似是一个接口. 当应用程序调用这些接口程序时,计算机是如何进入内核的呢?这是经过了系统调用. 实际上当调用接口函数 ...

  2. git删除远程仓库的文件或目录

    git rm -r --cached a/2.txt //删除a目录下的2.txt文件   删除a目录git rm -r --cached a git commit -m "删除a目录下的2 ...

  3. 实现鼠标拖动canvas绘制的图片

    不啰嗦上代码: <html> <head> <meta http-equiv="Content-Type" content="text/ht ...

  4. ES6 数组解构赋值

    .数组解构 let [a, b, c,d] = ["aa", "bb", 77,88]; alert(a) //弹出aa 可以用babel 解析看ES5的转换结 ...

  5. http://www.cnblogs.com/figure9/p/developer-reading-list.html

    http://www.cnblogs.com/figure9/p/developer-reading-list.html

  6. mysql ERROR 1045 (28000): Access denied for user解决方法

    一 这种情况下是 root@% update mysql.user set host='%' where user='root' and host='localhost'; flush privile ...

  7. Linux Linux程序练习十四(多进程压力测试)

    /* * 题目: * 编程一个基本多进程测试框架,提示用户输入进程数.和每个进程数运行圈数.(fork) * 进行多进程压力测试.(execve) * 要求父进程能监控所有子进程的退出,避免僵尸进程. ...

  8. Atom插件安装

    Atom插件安装 Atom狂拽炫酷插件之activate-power-mode 引语: 在前文中提到了关于插件的安装,似乎简单易操作,不过最后我发现是我自己想简单了. activate-power-m ...

  9. Ubuntu环境下安装TinyOS系统

    1.输入下面命令会弹出source list窗口   1 sudo gedit /etc.apt/sources.list 在尾部添加以下地址:   1 2 deb http://tinyos.sta ...

  10. spring注解scheduled实现定时任务

    只想说,spring注解scheduled实现定时任务使用真的非常简单. 一.配置spring.xml文件 1.在beans加入xmlns:task="http://www.springfr ...