$(selector).fadeTo(speed, opacity);
$(selector).fadeTo(speed, opacity, callback);
$(selector).fadeTo(speed, opacity, easing, callback);
<!DOCTYPE html>
<html>
<head>
<script src="/ajax/libs/JQuery/1.11.2/JQuery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("#div1").fadeTo("slow", 0.3);
$("#div2").fadeTo("slow", 0.4);
$("#div3").fadeTo("slow", 0.5);
});
});
</script>
</head>
<body>
<p>请参阅带有不同参数的fadeTo()方法示例。</p>
<button>单击以淡入淡出框</button><br><br>
<div id="div1" style="width:80px;height:80px;background-color:red;"></div><br>
<div id="div2" style="width:80px;height:80px;background-color:green;"></div><br>
<div id="div3" style="width:80px;height:80px;background-color:blue;"></div>
</body>
</html>
请参阅带有不同参数的fadeTo()方法示例。