Created
October 28, 2014 09:10
-
-
Save 303182519/a6d5d8faef6a4bfa502f to your computer and use it in GitHub Desktop.
一个解绑的测试
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
<style type="text/css"> | |
*{ | |
margin: 0; | |
padding: 0; | |
} | |
div { | |
width: 100px; | |
height: 50px; | |
background: #000; | |
margin-bottom: 20px; | |
cursor: pointer; | |
color: #fff; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="a">a</div> | |
<div id="b">b</div> | |
<div id="e">e</div> | |
<div id="c">c</div> | |
</body> | |
<script type="text/javascript" src="http://sz.duowan.com/s/jquery/jquery.js"></script> | |
<script type="text/javascript"> | |
$(function(){ | |
function a(){ | |
alert("a"); | |
} | |
function b(){ | |
alert("b"); | |
} | |
function e(){ | |
alert("e"); | |
} | |
/*$("body").delegate("#a","click.a",a); | |
$("body").delegate("#b","click.b",b); | |
$("#c").on("click",function(){ | |
$("body").unbind('.a'); | |
})*/ | |
$("body").on("click.a","#a",a); | |
$("body").on("click.a","#e",e); | |
$("body").on("click","#b",b); | |
$("#c").on("click",function(){ | |
$("body").off('.a'); | |
}) | |
}) | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment