仿W8屏保

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>防W8系统屏保</title> <script>
(JS={
$:function(o){return typeof o=="string"?document.getElementById(o):o},
dingwei:false,
shubiao:0,
weizhi:0,
on:function(o,type,fn){o.attachEvent?o.attachEvent('on'+type,function(){fn.call(o)}):o.addEventListener(type,fn,false);return JS.on}, fn1:function(o,attr){
e= arguments.callee.caller.arguments[0]||window.event;
var b=e.clientY this.shubiao=b;
this.dingwei=true;
this.weizhi=parseInt(o.style[attr]) clearInterval(o["ll"])
}, fn2:function(o,attr){
if(this.dingwei){
var d= arguments.callee.caller.arguments[0]||window.event;
var dd=d.clientY-this.shubiao;
var cc=this.weizhi+dd;
if( dd<=0){
o.style[attr]=cc+"px"
}
}
}, fn3:function(o,attr){
this.dingwei=false;
var gg=parseInt(o.style[attr]);
clearInterval(o["ll"]);
if(gg<-300)
{
o["ll"]=setInterval(function(){ gg-=5; o.style[attr]=gg+"px"; if(gg<-(screen.height)){
clearInterval(o["ll"])
}
},10)
}
else if(gg>=-300&&gg<-5){
o["ll"]=setInterval(function(){ gg+=5; o.style[attr]=gg+"px"; if(gg>=-5){
clearInterval(o["ll"])
}
},10)
}
}, }).on(window,"load",function(){
var Q=JS.$("bb");
JS.on(Q,"mousedown", function(){ JS.fn1(Q,"top")})
(Q,"mousemove",function(){ JS.fn2(Q,"top")})
(Q,"mouseup",function(){JS.fn3(Q,"top")})
(Q,"mouseout",function(){JS.fn3(Q,"top")})
}) </script>
</head>
<body>
<div id="bb" style=" position:absolute; top:0px; left:0px; width:100%;height:100%; cursor:pointer; background-color:#06F;">
</div>
</body></html>
面向对象:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head> <script type="text/javascript">
function WP8(id){
var $this=this;
this.kongzhi=false;
this.cY1=null;
this.cY2=null;
this.weizhi=null;
this.oid=document.getElementById(id);
this.oid.onmousedown=function(e){var e=e||window.event; $this.cY1=e.clientY;$this.fn1()};
this.oid.onmousemove=function(e){var e=e||window.event; $this.cY2=e.clientY;$this.fn2()};
this.oid.onmouseup=function(){$this.fn3()};
this.oid.onmouseout=function(){$this.fn3()};
}; WP8.prototype.fn1=function(){
this.kongzhi=true;
this.weizhi=parseInt(this.oid.style["top"]);
}; WP8.prototype.fn2=function(){
if(this.kongzhi&&(this.cY2-this.cY1)<0){
this.oid.style["top"]=this.weizhi+(this.cY2-this.cY1)+"px";
} }; WP8.prototype.fn3=function(){
this.kongzhi=false;
var this1=this
var gg=parseInt(this.oid.style["top"]);
clearInterval(this['qingchu']);
if(gg<-300){ this['qingchu']=setInterval(function(){
gg-=5;
this1.oid.style["top"]=gg+"px"; if(gg<-(screen.height)){clearInterval(this1['qingchu']);} },10) } else if(gg>=-300&&gg<-5){
this['qingch']=setInterval(function(){ gg+=5;
this1.oid.style["top"]=gg+"px"; if(gg>=0){clearInterval(this1['qingch']);}
},10 ) } }; window.onload=function(){ new WP8("bb")
}
</script>
<body> <div id="bb" style=" position:absolute; top:0px; left:0px; width:100%;height:100%; cursor:pointer; background-color:#06F;"> </div>
</body>
</html>
仿W8屏保的更多相关文章
- 一个仿windows泡泡屏保的实现
一个仿windows泡泡屏保的实现 有天看到有人在百度知道上问windows 泡泡屏保该怎么用C#做,一时有趣,就做了一个出来,对于其中几个要点总结如下: 一,屏保程序的制作要求 屏保程序的扩展名是. ...
- C#制作简易屏保
前言:前段时间,有个网友问我C#制作屏保的问题,我瞬间懵逼了(C#还可以制作屏保!).于是我去查阅相关资料,下面把C#如何制作屏保的过程及我学习过程的心得也记录下来,希望对需要的人能有帮助. 基本思路 ...
- Linux关闭休眠和屏保模式
本人因为特殊需求,想让某台Linux主机始终显示某个程序,显示器不能关机或者休眠或进入屏保模式. 环境:Ubuntu 11.10 最小化模式安装并安装有轻量级桌面openbox(非gnome).因为X ...
- [AIR] AS3.0设置屏保功能
package com.controls { import flash.desktop.NativeApplication; import flash.events.Event; import fla ...
- Win XP 如何禁用屏保
如果你试过 “在桌面空白处点击右键-[属性]-[屏幕保护程序],选择[无],点击[确定]”后,当时是可以去掉屏保.但如果重启计算机或者从待机状态唤醒后,屏保依然会出现,那么你可以试试下面的方法. 首先 ...
- wpf 制作播放视频的屏保程序、而且能分屏显示
这个程序用到了WPF里 “visual_Brush”(主要是为了实现分屏显示) , “UserControl” ,这两个知识点: 在屏保状态下播放指定文件夹下的视频,而且能分屏显示: 把编译好的屏保 ...
- C#制作简易屏保(转)
C#制作简易屏保[原创] 原始网址: http://www.cnblogs.com/drizzlecrj/archive/2006/10/06/522182.html 2006-10-06 16:25 ...
- python写的屏保程序
__author__ = 'ChenYan' from random import randint from tkinter import * class Randball(): def __init ...
- Android - Daydream 互动屏保
Android Daydream 互动屏保 API19 API23 Create:2016-03-01 继承DreamService来实现一个自定义屏保 Dreams是当充电的设备空闲,或者插入底座时 ...
随机推荐
- sql 操作常用操作语句 新增、修改字段等
常用sql --sql 事务 BEGIN TRAN 事物名 )BEGIN ROLLBACK TRAN 事物名;RETURN;END COMMIT TRAN 事物名 --数据库清缓存 DBCC DROP ...
- 2016年12月27日 星期二 --出埃及记 Exodus 21:22
2016年12月27日 星期二 --出埃及记 Exodus 21:22 "If men who are fighting hit a pregnant woman and she gives ...
- Unity手撸2048小游戏——背景文字控制
今天继续昨天的计划吧 1.新建项目.场景命名啥的都不说了吧. 2.直接开始新建一个Image,顺便把Image改名成Chessman 3.选中Image新建一个Text对象,调整下大小位置.这样就算完 ...
- JavaScript学习笔记(一):介绍JavaScript的一些简单知识
JavaScript是世界上最流行的编程语言.这门语言可用于HTML和web,更可广泛用于服务器.PC.笔记本电脑和智能手机等设备.---------------------------------- ...
- js取两个数组的交集|差集|并集|补集|去重示例代码
http://www.jb51.net/article/40385.htm 代码如下: /** * each是一个集合迭代函数,它接受一个函数作为参数和一组可选的参数 * 这个迭代函数依次将集合的每一 ...
- C#自定义大小与改变大下的方法
在用VS的窗体设计器时,我们可以发现控件都是可以拖动的,并且还可以调整大小.怎么在自己的程序中可以使用上述功能呢? 下面的方法值得借鉴! using System; using System.Wind ...
- InfoPackage的更新模式
声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...
- OpenLayers控制瓦片的绽放级别
先说说这个功能可能使用到的地方,当我们下载的网上瓦片或者矢量数据的第一级或开始几级效果不是很好时,我们就就想让用户看到这些级别的瓦片.实现这个功能比较简单,主要就是修改Openlayers.map的i ...
- Linux解读
Linux中权限(r.w.x)对于目录与文件的意义 一.权限对于目录的意义 1.首先要明白的是目录主要的内容是记录文件名列表和子目录列表,而不是实际存放数据的地方. 2.r权限:拥有此权限表示可以读取 ...
- Tutorial - Deferred Rendering Shadow Mapping 转
http://www.codinglabs.net/tutorial_opengl_deferred_rendering_shadow_mapping.aspx Tutorial - Deferred ...