<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="./jquery-2.2.4.min.js"></script>
<script>
$(function() {
//获取按钮并设置点击事件
$("button").click(function() {
switch($(this).html()) {
case "隐藏":
$("img").hide(500);
break;
case "显示":
//显示
//$("img").show(500);
//下来效果显示
$("img").slideDown(1000);
break;
case "切换":
//$("img").toggle(500);
//渐变效果切换
$("img").fadeToggle("slow");
break;
}
});
});
</script>
</head>
<body>
<h2 id="hid">jQuery实例:特效</h2>
<button>隐藏</button>
<button>显示</button>
<button>切换</button><br/><br/>
<img src="./images/22.jpg" width="300" />
</body>
</html>
来源:CSDN
作者:西红柿炒番茄AB
链接:https://blog.csdn.net/a_sid/article/details/53485013