仿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是当充电的设备空闲,或者插入底座时 ...
随机推荐
- DB2常用sql函数 (转载)
http://www.techonthenet.com/sql/index.php 一.字符转换函数 1.ASCII() 返回字符表达式最左端字符的ASCII 码值.在ASCII()函数中,纯数字的字 ...
- git github简单知识
Git 常用命令 git init here -- 创建本地仓库(repository),将会在文件夹下创建一个 .git 文件夹,.git 文件夹里存储了所有的版本信息.标记等内容 git remo ...
- git管理测试生产环境代码
利用post-update实现简单钩子 #!/bin/bash cd /www/test || exit #进入指定的目录 unset GIT_DIR #清楚环境变量 git checkout mas ...
- 判断浏览器是pc端还是手机端
1. 判断浏览器是pc端还是手机端 <script type="text/javascript"> var browser = { versions: function ...
- python字符串方法的简单使用
学习python字符串方法的使用,对书中列举的每种方法都做一个试用,将结果记录,方便以后查询. (1) s.capitalize() ;功能:返回字符串的的副本,并将首字母大写.使用如下: >& ...
- [转]CocoaPods安装和使用教程
转载地址:http://code4app.com/article/cocoapods-install-usage 目录 CocoaPods是什么? 如何下载和安装CocoaPods? 如何使用Coco ...
- vueJs+webpack单页面应用--vue-router配置
vue-route版本要跟vue版本同步,我的vue用的2.0+的,vue-router 也用了最新版2.1+ npm安装vue-router: $ npm install vue-router -- ...
- JAVA 中XML的解析
XML: 可扩展标记语言(extensible Markup Language) 用于标记电子文件使其具有结构性的标记语言.XML可以用来标记数据.定义数据类型,是一种允许用户对自己的标记语言进行定 ...
- 个人作业-Week2 案例分析
微软必应词典客户端的案例分析 第一部分 调研,评测 1)bug: 运行平台:iOS 10.0.2 必应词典版本:4.2.2 1. bug标题:词库加载错误 bug详细描述:学习界面中的经典词库出国考试 ...
- Apache开启状态查看页面(原创贴-转载请注明出处)
=================写在前面的话================== 场景描述:有时候我们需要查看apache的运行状态,只需要开启apache的status功能就可以实现,但是stat ...