javascript代码:
// JavaScript Document
var url_xinxi=getxinxi.php; //获取窗口显示内容的URL;
function tips_pop(){
var MsgPop=document.getElementById("winpop");
var popH=parseInt(MsgPop.style.height);//将对象的高度转化为数字
if (popH==0){
MsgPop.style.display="block";//显示隐藏的窗口
$.getJSON(url_xinxi, { name: "John", time: "2pm" },
function(data){
if(data.status=='sccess'){
$("#winpop").html(data.msg);
show=setInterval("changeH('up')",50);
}
});
}
else {
hide=setInterval("changeH('down')",50);
}
}
function changeH(str) {
var MsgPop=document.getElementById("winpop");
var popH=parseInt(MsgPop.style.height);
if(str=="up"){
if (popH<=140){
MsgPop.style.height=(popH+4).toString()+"px";
var topHeight2 = document.documentElement.scrollTop + document.documentElement.clientHeight - popH-4;
$("#winpop").css("top",topHeight2+"px");
}
else{
clearInterval(show);
}
}
if(str=="down"){
if (popH>=4){
MsgPop.style.height=(popH-4).toString()+"px";
}
else{
clearInterval(hide);
MsgPop.style.display="none"; //隐藏DIV
}
}
}
function tips_pop2(str) {
document.getElementById('winpop').style.height='0px';
document.getElementById('winpop').style.display="none";
tips_pop();
setTimeout("tips_pop2()",60000);
}
$(document).ready(function(){
if($("#winpop").length>0){
//第一次加载执行
window.onload=function(){//加载
document.getElementById('winpop').style.height='0px';
setTimeout("tips_pop()",3000);//3秒后调用tips_pop()这个函数
}
//每一分钟执行
$(function () {
setTimeout("tips_pop2()",60000);
});
//滚动条
$(window).scroll( function() {
var MsgPop=document.getElementById("winpop");
var popH=parseInt(MsgPop.style.height);//将对象的高度转化为数字
var topHeight = document.documentElement.scrollTop + document.documentElement.clientHeight - popH;
$("#winpop").css("top",topHeight+"px");
});
}
});
html代码:
<html>
<style>
/*右下信息提示*/
#winpop { width:264px; height:0px;position:absolute; right:0; bottom:0; border:1px solid #66CC33; margin:0; padding:0px; overflow:hidden; display:none;}
#winpop .title { width:100%; height:28px; line-height:28px; background:#66CC33;text-align:left; font-size:12px; color:#ffffff;padding-left:10px; background:url(../../images/icon/yx_title.gif);}
#winpop .con { width:260; min-height:110px;line-height:20px; padding:10px; text-align:left; font-size:12px; color:#000000; text-decoration:none; background:#FFFFFF; overflow:hidden; }
#silu { font-size:12px; color:#666; position:absolute; right:0; text-align:right; text-decoration:underline; line-height:22px;}
.close { position:absolute; right:4px; top:-1px; color:#FFF; cursor:pointer}
</style>
<body>
<!--弹出窗-->
<div id="winpop">
</div>
<!--end-->
</body>
</html>
说明:
定义和用法
setInterval() 方法可按照指定的周期(以毫秒计)来调用函数或计算表达式。 setInterval() 方法会不停地调用函数,直到 clearInterval() 被调用或窗口被关闭。由 setInterval() 返回的 ID 值可用作 clearInterval() 方法的参数。
语法
setInterval(code,millisec[,"lang"])
参数 描述
code 必需。要调用的函数或要执行的代码串。
millisec 必需。周期性执行或调用 code 之间的时间间隔,以毫秒计。
返回值
一个可以传递给 Window.clearInterval() 从而取消对 code 的周期性执行的值。
setTimeout() 只执行 code 一次。如果要多次调用,请使用 setInterval() 或者让 code 自身再次调用 setTimeout()。
分享到:
相关推荐
我的网址:www.0379zd.com欢迎光临。jQuery插件(右下弹出窗口),很实用,很漂亮。
写好的js特效右下脚弹出窗口,帮你作出好看功能强大的前台界面。please download now!
仿QQ 右下 自动弹出窗口 c#版本 需要的请下载
网上找到的一个Jquery,但是出现滚动条滚动时的Bug,已修改,可以放心使用!
代码: <SCRIPT language=javascript> window.onload = enetgetMsg; window.onresize = enetresizeDiv; window.onerror = function(){} var enetdivTop,enetdivLeft,enetdivWidth,enetdivHeight,enetdocHeight...
C#.NET 实现右下角弹出窗口
右下脚图片弹窗广告代码右下脚图片弹窗广告代码右下脚图片弹窗广告代码
从窗口右下脚弹出的仿QQ的提示框
新浪奥运频道的Js右下角浮动窗口代码,可推荐使用。
可以用来弹出广告,视频等的一个小技术。 值得保存
使用TaskbarNotifier,用多线程一次弹出多个消息框
带动画效果jQuery+CSS3实现的弹出框弹出层效果,效果不错的JS弹出层特效,带动画效果弹出 带关闭按钮、取消按钮、确认按钮,具体确认事件,取消事件大家可以自己去完成了。
仿QQ新闻右下角弹出窗口 窗口为源码 .导入PBL即可
jQuery点击右侧弹出选择城市代码基于jquery.1.10.2.min.js制作,自适应分辨率,兼容PC端和移动端,省市二级联动代码。
这个是真的可以浮动的 有的网上源码在dramweaver里面可以浮动 但是丢到网页上就不行了 本代码就将该问题解决了
背投广告,播放完后弹回右下角,可重复播放!!
在Swing开发时,有个地方需要实现窗口右下解的浮动窗口效果 必须及时信息提示,新闻预览等。
jquery商城网站右下角浮动窗口商品随机展示效果代码
右下漂浮广告代码破任何浏览器正常显示 简单小巧易用