在网页上显示漂浮移动效果
来源:互联网 发布:Java restpath 编辑:程序博客网 时间:2024/04/27 22:51
效果图
代码:
<div id="sa" style="position:absolute; left=0; top=0">
<a href="http://www.cnblogs.com/happygx" target="_blank"><img src="qq.png"/></a>
</div>
<script type="text/javascript">
var dirX =1;
var DirY =1;
var Xpos =0, Ypos =0;
sa.style.top =0;
document.body.all.sa.style.left =0;
//document.body.all("sa").style.visibility="visible";visibility:hidden;
setInterval("dd()", 10);
function dd() {
Xpos +=2* dirX;
Ypos +=2* DirY;
sa.style.top = Xpos;
sa.style.left = Ypos;
//当X方向到达时反向
if (Xpos <=0|| Xpos + sa.offsetWidth >= document.body.clientHeight) {
dirX =-dirX ;
}
//当y方向到达时反向
if (Ypos <=0|| Ypos + sa.offsetHeight >= document.body.clientWidth) {
DirY =-DirY ;
}
}
</script>
<a href="http://www.cnblogs.com/happygx" target="_blank"><img src="qq.png"/></a>
</div>
<script type="text/javascript">
var dirX =1;
var DirY =1;
var Xpos =0, Ypos =0;
sa.style.top =0;
document.body.all.sa.style.left =0;
//document.body.all("sa").style.visibility="visible";visibility:hidden;
setInterval("dd()", 10);
function dd() {
Xpos +=2* dirX;
Ypos +=2* DirY;
sa.style.top = Xpos;
sa.style.left = Ypos;
//当X方向到达时反向
if (Xpos <=0|| Xpos + sa.offsetWidth >= document.body.clientHeight) {
dirX =-dirX ;
}
//当y方向到达时反向
if (Ypos <=0|| Ypos + sa.offsetHeight >= document.body.clientWidth) {
DirY =-DirY ;
}
}
</script>
1 0
- 在网页上显示漂浮移动效果
- js - 图标在网页上漂浮移动效果
- js - 图标在网页上漂浮移动效果
- 在网页上显示黑客帝国字幕效果
- 用http-server在移动设备上查看网页效果
- FLASH嵌入网页中,漂浮在页面上
- 网页在移动端上显示不完整
- JS实现网页漂浮广告效果简单
- jquery做的网页漂浮效果
- word显示在网页上
- PDF在网页上显示
- 网页上的漂浮物制作代码
- 在网页上显示一个会移动的透明时钟的代码。。。
- 在网页上显示一个会移动的透明时钟的代码。。。
- 在网页上显示一个会移动的透明时钟的代码。。。
- Bootstrap初级用户谈谈网页在手机上的显示效果优化
- 在网页上启动移动设备APP
- 固定漂浮在左边的效果
- 排列算法
- iOS-软键盘
- A + B Problem II hd 1002
- uvaLive 3263 That Nice Euler Circuit 欧拉定理
- SQL 生产随时唯一32位字符串
- 在网页上显示漂浮移动效果
- HDU 5726 GCD(RMQ+二分,详解)
- 三维计算几何模板 hdu 5733 tetrahedron(不知为何WA)
- 16.7.20
- ios 竖屏支持个别界面横屏
- python联网安装缺乏的包
- AIDL的实现
- JSON序列化与反序列化,读、写
- web程序首页配置