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的更多相关文章
随机推荐
- 第13章 Windows内存体系结构
13.1 Windows的虚拟地址空间安排 13.1.1虚拟地址空间的分区(即虚拟地址空间布局) 进程的地址空间划分 分区 x86 32位 Windows 3GB用户模式下的x86 32位Window ...
- unity3D里面的点乘和叉乘
在unity3D里面.两个向量的点乘所得到的是两个向量的余弦值,也就是-1 到1之间,0表示垂直,-1表示相反,1表示相同方向. 两个向量的叉乘所得到的是两个向量所组成的面的垂直向量,分两个方向. 简 ...
- XPATH基础入门资料
http://www.w3school.com.cn/xpath/xpath_syntax.asp 不错的网址,入门学习资料
- 【原创】有关Silverlight DataGrid双击事件的分析 完整分析 代码与示例
公司项目用的silverlight,而且silverlight一些技术 资料比较少.所以分享出来 给大家参考参考. 有关Silverlight中DataGrid 双击事件 的代码 如下: 1. 前台x ...
- IC系统组成概论
IC系统是什么? 对算法工程师来说,IC系统是完成特定功能的硬件.对架构设计师来说,IC系统包括控制,运算,存储部分.电路设计工程师来说,IC系统是加法器,乘法器,与非门,运算放大器,开关电容等的搭配 ...
- PHP基础16:多维数组
<?php //1.PHP-两维数组 $cars=array ( array("Volvo",22,18), array("BMW",15,13), ar ...
- Windows下MemCache多端口安装配置
Windows下MemCache环境安装配置的文章很多,但大部分都是用的默认端口11211,如何修改默认端口.如何在一台服务器上配置多个MemCache端口?这正式本文要解决的问题. 1.从微软官网下 ...
- HMAC-MD5算法原理及实现
以下是分析节选,对于更详细的描述可以查阅RFC2104文档. HMAC需要一个加密用散列函数(表示为H)和一个密钥K. 假设H是一个将数据块用一个基本的迭代压缩函数来加密的散列函数. 用B来表 ...
- MATLAB-2015a安装
&1 准备工作 软件和破解文件 软件以64位为例:链接:http://pan.baidu.com/s/1qYQQPli 密码:nc1y 解压密码:www.0daydown.com 破解文件: ...
- tkinter 改变按钮状态
import tkinter as tk def btn1_change_btn1(event): '''方式一:通过事件控制自己''' if event.widget['state'] == 'no ...