当前位置: 移动技术网 > IT编程>开发语言>JavaScript > jQuery的slideToggle方法实例

jQuery的slideToggle方法实例

2019年01月17日  | 移动技术网IT编程  | 我要评论

代码如下:

<title></title>
<style type="text/css">
.imgclass{ width:300px; height:300px; border:solid 1px red;}
</style>
<script src="jquery-1.9.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$('#button1').bind('click', function () {
$('img').slideup(2000);
})
$('#button2').bind('click', function () {
$('img').slidedown(2000);
})
$('#button3').bind('click', function () {
$('img').slidetoggle(2000);
})
})
</script>
</head>
<body>
<p>
<p>
<input id="button1" type="button" value="上拉" /><input id="button2" type="button" value="下拉" /><input id="button3" type="button" value="自动上拉下拉" /></p>
<p><img src="images/1.jpg" class="imgclass"/></p>
</p>
</body>

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网