bugzilla_firefox
//本来要给火狐提交bug的,发现复现不鸟,我勒个去
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>
<style>
html,body{
width:100%;
height:100%;
}
body{
position:relative
}
section{
position:absolute
}
.s1{
left:10px;
}
.s2{
left:40px;
}
.s3{
left:80px
}
input{
display:none;
outline:none
}
</style>
<body>
<section class="s1">
11
</section>
<section class="s2">
11
</section>
<section class="s3">
11
</section>
<input type="text">
<script>
var Drag = function( e ){
this.e = typeof e === "string" ? document.getElementById(e) : e;
this.initDrag();
}
Drag.prototype = {
zIndex : 0,
constructor : Drag,
initDrag : function(){
this.e.addEventListener("mousedown",this.ev.bind(this));
},
ev : function(e){
switch(e.type){
case "mousedown":
this.dx = e.clientX - this.e.offsetLeft;
this.dy = e.clientY - this.e.offsetTop;
this.e.zIndex = this.zIndex++;
this.fn = this.ev.bind(this);
document.addEventListener("mousemove",this.fn);
document.addEventListener("mouseup",this.fn);
break;
case "mousemove":
this.e.style.left = e.clientX - this.dx + "px";
this.e.style.top = e.clientY - this.dy + "px";
break;
case "mouseup":
document.removeEventListener("mouseup",this.fn)
document.removeEventListener("mousemove",this.fn)
break;
};
e.cancelBubble = true;
e.defaultPrevented = true;
e.stopPropagation();
e.preventDefault();
return
}
};
Array.prototype.slice.call(document.querySelectorAll("section"),null).forEach(function(e,i){
new Drag(e);
e.addEventListener("mouseup",function(){
var css = Object.create( window.getComputedStyle(e,null) ),
t = parseInt(css.top) + "px",
l = parseInt(css.left) + "px";
/************************************/
e.style.left = 0;
e.style.top = 0;
/************************************/
console.log( window.getComputedStyle(e,null).left )
console.log( window.getComputedStyle(e,null).top )
e.style.left = l
e.style.top = t
});
});
</script>
</body>
</html>
bugzilla_firefox的更多相关文章
随机推荐
- POJ 3233 Matrix Power Series --二分求矩阵等比数列和
题意:求S(k) = A+A^2+...+A^k. 解法:二分即可. if(k为奇) S(k) = S(k-1)+A^k else S(k) = S(k/2)*(I+A^(k/2)) ...
- UVA 11766 Racing Car Computer --DP
题意:电脑记录了某一时刻每个赛车的前面和后面个有多少辆车(多个车并排时在别的车那只算一辆),问最少有多少个不合理的数据. 分析:看到n<=1000时,就尽量往DP上想吧. 每输入一组数据a,b, ...
- Oracle中没有 if exists(...)
对于Oracle中没有 if exists(...) 的语法,目前有许多种解决方法,这里先分析常用的三种,推荐使用最后一种 第一种是最常用的,判断count(*)的值是否为零,如下declare v ...
- PHP mcrypt加密扩展使用总结
在开发中,很多时候我们在前后端交互中需要对一些敏感数据进行一定的加密.PHP中有提供了mcrypt的这样一个加密扩展实现对数据的加密解密. 一.mcrypt扩展的安装 在低版本的PHP中需要在配置文件 ...
- RDLC系列之六 打印纸张的大小(未解决)
问题: 当报表的宽度大于高度的时候,RDLC就默认成横向打印了,把打印纸竖着放就可以正常打印了,但是如果是针式打印机的话,纸张不能连续打印. 如果把宽度和高度值对调,然后横向放纸,打印机里选择“竖打” ...
- 【转】【C#】SendMessage
SendMessage是一个在user32.dll中声明的API函数,在C#中导入如下: using System.Runtime.InteropServices; [DllImport(" ...
- MySQL主从同步几个文件
MySQL主从同步: M锁表 M导出S导入 M解锁 M建同步帐号 S获取点位:产生master.info S开启同步 3306: mysql-bin.0000x mysql-bin.index ...
- C语言 结构体中的成员域偏移量
//C语言中结构体中的成员域偏移量 #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<stdlib.h> # ...
- IP+IDC-chinaz抓取
#-*-coding:gbk-*- #code by anyun.org import urllib import re import time def getHtml(url): page = ur ...
- 一个按钮,如果5分钟内点击再次点击给予提示操作频繁,在JS里可以这样写
很简单. 但是,如果你要离开这个页面再进来, 就没办法限制了. 除非用cookie 储存状态 给个示例 var isLock = flase; //定义全局变量 按钮点击事件: if(isLock){ ...