日期:2014-05-16 浏览次数:20419 次
// 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> <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>