惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

AI
AI
TaoSecurity Blog
TaoSecurity Blog
H
Heimdal Security Blog
Help Net Security
Help Net Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Microsoft Azure Blog
Microsoft Azure Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Google DeepMind News
Google DeepMind News
爱范儿
爱范儿
The Cloudflare Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
人人都是产品经理
人人都是产品经理
大猫的无限游戏
大猫的无限游戏
N
News | PayPal Newsroom
V2EX - 技术
V2EX - 技术
博客园 - 【当耐特】
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
Secure Thoughts
C
CERT Recently Published Vulnerability Notes
罗磊的独立博客
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Privacy & Cybersecurity Law Blog
有赞技术团队
有赞技术团队
S
Schneier on Security
S
SegmentFault 最新的问题
Google Online Security Blog
Google Online Security Blog
H
Hacker News: Front Page
The Last Watchdog
The Last Watchdog
Schneier on Security
Schneier on Security
PCI Perspectives
PCI Perspectives
IT之家
IT之家
Project Zero
Project Zero
博客园 - 司徒正美
P
Privacy International News Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Jina AI
Jina AI
Security Latest
Security Latest
Hacker News - Newest:
Hacker News - Newest: "LLM"
腾讯CDC
C
CXSECURITY Database RSS Feed - CXSecurity.com
阮一峰的网络日志
阮一峰的网络日志
C
Check Point Blog
aimingoo的专栏
aimingoo的专栏
V
Vulnerabilities – Threatpost
W
WeLiveSecurity
NISL@THU
NISL@THU
Webroot Blog
Webroot Blog
N
Netflix TechBlog - Medium
L
Lohrmann on Cybersecurity

博客园 - zhuibobo

SQL将多行连接显示 SQL逻辑查询处理中的各个阶段 基于Web用户控件的Portal flex-流程设计器 WebHL(模仿QQ写的Ajax程序)^_^ JavaScript笔记(可以被钉住的层) 新手的入门-设计模式二[一块开工厂把~] 新手的入门-设计模式一[玩玩策略吗?] 读取sql2000,sql2005中的表结构[转贴] 代码生成器(Asp.net(C#)) 十五天的假期-11 十五天的假期-9 十五天的假期-10 十五天的假期-8 十五天的假期-7 十五天的假期-5 十五天的假期-6 十五天的假期-4 十五天的假期-3
JavaScript笔记(带动画效果弹出的层)
zhuibobo · 2008-01-06 · via 博客园 - zhuibobo

    好久没写过js的东西了..从前一段时间痴迷过后,最近有见识到了ext的强大,不过嘛,写一些简单的,基础的实现还是自己来好了..不过ext确实很强大,没看过的人试试把~呵呵~
    这是一个带动画效果的弹出的层,然后关闭也加入了动画的效果,然后使层具有被拖动的功能.动画效果其实就是用了4个偏移量left,top,x,y和定时器实现的.拖动嘛,是注册带document的mousemove的事件实现的.
   先看看拖动的代码..
   canBeDrag.prototype={
        initialize:function(sender)
        {
            sender.onmousedown=function()
            {
                var backDiv=this.backDiv;
                var offsetX=event.clientX-sender.offsetLeft;
                var offsetY=event.clientY-sender.offsetTop;
                document.body.onmousemove=function()
                {
                    sender.style.left=event.x-offsetX;
                    sender.style.top=event.y-offsetY;
                }
            }
            sender.onmouseup=function()
            {
                document.body.onmousemove=null;
                document.body.onmouseup=function()
                {
                    document.body.onmousemove=null;
                }
            }
        }
        }
然后要让这个层可以拖动注册
var sender1=$("dragDiv1");
var sender2=$("dragDiv2");
var sender3=$("dragDiv3");
var drag1=new canBeDrag(sender1);
var drag2=new canBeDrag(sender2);
var drag3=new canBeDrag(sender3);就可以了

恩,因为用了prototype来定义的类,所以就不全帖出来了..有兴趣的直接下载下去看看把~呵呵.
例子下载

posted on 2008-01-06 18:33  zhuibobo  阅读(1333)  评论()    收藏  举报