当前位置: 移动技术网 > IT编程>开发语言>JavaScript > jQuery fadeTo方法调整图片的透明度使用介绍

jQuery fadeTo方法调整图片的透明度使用介绍

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

代码如下:

<head>
<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 () {
$('#select1').change(function () {
var thevalue = $(this).val();
$('img').fadeto(2000, thevalue);
})
})
</script>
</head>
<body>
<table>
<tr>
<td>
透明度:
<select id="select1">
<option value="0">0</option>
<option value="0.2">0.2</option>
<option value="0.4">0.4</option>
<option value="0.6">0.6</option>
<option value="0.8">0.8</option>
<option value="1">1</option>
</select>
</td>
<td>
<img src="images/泪奔1.gif" class="imgclass" />
</td>
</tr>
</table>
</body>

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

相关文章:

验证码:
移动技术网