做一个JQuery右下角消息框弹窗
2011-03-15 00:00
316 查看
#newnotice {
position:absolute;
display:none;
width:250px;
border:solid #9BDF70 1px;
background-color: #F0FBEB
}
#newnotice p {
font-size:12px;
margin:1px;
padding:0px 2px 0px 5px;
background-color:#C2ECA7;
color:#666666;
height:20px;
line-height:20px;
}
#newnotice p .title {
float:left;
}
#newnotice p #bts {
display:block;
float:right;
width:48px;
height:15px;
}
#newnotice p #bts .button {
display:block;
float:left;
width:15px;
height:15px;
line-height:15px;
cursor:pointer;
}
#newnotice p #bts #tomin {
background:url(../../images/201202/btns.gif) no-repeat 0px 3px; height:15px; width:15px;
/* background-position:center; */
}
#newnotice p #bts #tomax {
background:url(../../images/201202/btns.gif) no-repeat -17px 2px; height:15px; width:15px;
/* background-position:center; */
}
#newnotice p #bts #toclose {
background-image:url(http://www.nowamagic.net);
}
#newnotice div {
font-size:12px;
margin:1px;
padding:0px 5px 0px 5px;
background-color:#FFFFFF;
color:#999999;
height:125px;
line-height:20px;
}
#noticecon ol li
{
overflow:hidden;
height:22px;
line-height:22px;
}
右下角弹窗在互联网上使用得非常普遍,虽然这种方式会很大地影响到用户体验,但是领导有这个要求,我们还是得做。下面是介绍一个刚写的弹窗例子,做得还算凑合吧。scroll : 滚动时候保持在页面右侧底部,resize: 浏览器变化时候保持在页面右侧底部。
Jquery Code:
HTML Code:
最热新闻
×
position:absolute;
display:none;
width:250px;
border:solid #9BDF70 1px;
background-color: #F0FBEB
}
#newnotice p {
font-size:12px;
margin:1px;
padding:0px 2px 0px 5px;
background-color:#C2ECA7;
color:#666666;
height:20px;
line-height:20px;
}
#newnotice p .title {
float:left;
}
#newnotice p #bts {
display:block;
float:right;
width:48px;
height:15px;
}
#newnotice p #bts .button {
display:block;
float:left;
width:15px;
height:15px;
line-height:15px;
cursor:pointer;
}
#newnotice p #bts #tomin {
background:url(../../images/201202/btns.gif) no-repeat 0px 3px; height:15px; width:15px;
/* background-position:center; */
}
#newnotice p #bts #tomax {
background:url(../../images/201202/btns.gif) no-repeat -17px 2px; height:15px; width:15px;
/* background-position:center; */
}
#newnotice p #bts #toclose {
background-image:url(http://www.nowamagic.net);
}
#newnotice div {
font-size:12px;
margin:1px;
padding:0px 5px 0px 5px;
background-color:#FFFFFF;
color:#999999;
height:125px;
line-height:20px;
}
#noticecon ol li
{
overflow:hidden;
height:22px;
line-height:22px;
}
右下角弹窗在互联网上使用得非常普遍,虽然这种方式会很大地影响到用户体验,但是领导有这个要求,我们还是得做。下面是介绍一个刚写的弹窗例子,做得还算凑合吧。scroll : 滚动时候保持在页面右侧底部,resize: 浏览器变化时候保持在页面右侧底部。
效果演示
如右下角效果所示。Jquery Code:
<script type="text/javascript"> $(function(){ $(window).load(function(){ $("div[id=newnotice]").css({"right":"0px","bottom":"1px"}); $("div[id=newnotice]").slideDown("slow"); }).scroll(function(){ $("div[id=newnotice]").css({"bottom":"0px"}); $("div[id=newnotice]").css({"right":"0px","bottom":"1px"}); }).resize(function(){ $("div[id=newnotice]").css({"bottom":""}); $("div[id=newnotice]").css({"right":"0px","bottom":"1px"}); }); $("label[id=tomin]").click(function(){ $("div[id=noticecon]","div[id=newnotice]").slideUp(); }); $("label[id=tomax]").click(function(){ $("div[id=noticecon]","div[id=newnotice]").slideDown(); }); $("label[id=toclose]").click(function(){ $("div[id=newnotice]").hide(); }); /** $.get("http://www.nowamagic.net/cgi/test.xml", function(data){ $(data).find('channel').find('item').each(function(index, ele){ var titles = $(ele).find('title').text(); var links = $(ele).find('link').text(); $("#noticecon").find('ol').append('<li><a href="'+links+'">'+titles+'</a></li>'); }) }); **/ }); </script>
HTML Code:
<div id="newnotice"> <p> <span class="title">最热新闻</span> <span id="bts"> <label class="button" id="tomin" title="最小化">_</label> <label class="button" id="tomax" title="最大化">口</label> <label class="button" id="toclose" title="关闭">×</label> </span> </p> <div id="noticecon"> <ol> </ol> </div> </div>
最热新闻
×
相关文章推荐
- 一个超棒的消息提示jQuery插件 - Noty
- 自己整理一个div的jquery弹窗效果
- 一个基于jQuery写的弹窗效果(附源码)
- 分享一个基于jQuery,backbone.js和underscore.js的消息提示框架 - Backbone.Notifier
- 一个简单的页面弹窗插件 jquery.pageMsgFrame.js
- layer(全称:jQuery-plugin-layer),一个可以让你想到即可做到的web弹窗(层)解决方案(js组件)非常好的层效果
- 一个jQuery的弹窗显示后消失,
- 一个基于jQuery写的弹窗效果(附源码)
- 一步一个记录--简单的jquery轮播图,按钮状态控制,layer弹窗
- 分享一个基于jQuery,backbone.js和underscore.js的消息提示框架 -...
- 一个超棒的消息提示jQuery插件 - Noty
- 一个超棒的消息提示jQuery插件 - Noty
- 分享一个jQuery iframe 弹窗插件Boxen
- Jquery实现自定义消息弹窗
- 一个简单的消息提示jquery插件
- jquery的一个消息插件
- 用Jquery 写一个简单的消息提醒(带声音提示)
- 项目中用到的一个小插件,基于jQuery的消息提醒 toastr.js
- jQuery的DOM操作实例(3)——创建节点&&编写一个弹窗
- 分享一个基于jQuery,backbone.js和underscore.js的消息提示框架 - Backbone.Notifier