实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<script src="https://libs.baidu.com/jquery/1.10.2/jquery.min.js">
5
</script>
6
<script>
7
function changeSize()
8
  {
9
  $(this).animate({fontSize:"+=3px"});
10
  }
11
function changeSpacing()
12
  {
13
  $(this).animate({letterSpacing:"+=2px"});
14
  }
15
16
$(document).ready(function(){
17
  $("body").on("click","p",changeSize);
18
  $("body").on("click","p",changeSpacing);
19
  $("button").click(function(){
20
    $("body").off("click","p");
21
  });
22
});
23
</script>
24
</head>
25
<body>
26
27
<p>This is a paragraph.</p>
28
<p>This is another paragraph.</p>
29
<p>Click any p element to increase size and letterspacing.</p>
30
<button>Remove all click event handlers</button>
31
32
</body>
33
</html>