现在的位置: 首页 > 综合 > 正文

滑入滑出效果的弹出窗口

2012年05月16日 ⁄ 综合 ⁄ 共 779字 ⁄ 字号 评论关闭
<script>
var movwin,targetX,step
function newwin(w,h){
movwin=window.open("","demo","width="+w+",height="+h)
movwin.document.write(subwin.innerHTML)
movwin.document.close()
targetX=(screen.width-w)/2
step=(targetX-movwin.screenLeft)/10
movwin.moveTo(-w,(screen.height-h)/2)
moveit()
}
function moveit(){
if(!movwin.closed&&movwin.screenLeft<targetX){
   movwin.moveBy(step,0)
   setTimeout("moveit()",10)
   step=(targetX-movwin.screenLeft)/10
}
}
</script>
<button onClick="newwin(150,100)">打开滑动窗口</button>
<xmp style="display:none" id="subwin">
<script>
var step=0.1
function closeit(){
if(screenLeft<screen.width) {
  step*=1.15
  self.moveBy(step,0)
  setTimeout("closeit()",10)
}
else self.close()
}
</script> <br><a target=_blank href=http://www.7788ok.com/blog>my bolg</a>
<button onClick="closeit()">关闭滑动窗口</button>
</xmp>

抱歉!评论已关闭.