实例代码“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:"+=10px"});
10
  }
11
function changeSpacing()
12
  {
13
  $(this).animate({letterSpacing:"+=5px"});
14
  }
15
  
16
$(document).ready(function(){
17
  $("p").on("click",changeSize);
18
  $("p").on("click",changeSpacing);
19
  $("button").click(function(){
20
    $("p").off("click",changeSize);
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
31
<button>Remove the changeSize() event handler</button>
32
33
</body>
34
</html>