<div class="codetitle"> <span><a style="CURSOR: pointer" data="72770" class="copybut" id="copybut72770" onclick="doCopy('code72770')"><u>複製程式碼</u></a></span> 程式碼如下:</div> <div class="codebody" id="code72770"> <br><title></title> <br><br> <br><title></title> <br><style type=" text/css"> <BR>.imgclass{ width:300px; height:300px; border:solid 1px red;} <BR></style> <br><script src="jquery-1.9.1.js" type="text/javascript"></script> <br><script type="text/javascript"> <BR>$(function () { <BR>$('#Button1').bind('click', function () { <BR>$('img').fadeOut(2000, function () { <BR>$('#Button1').val('哎,沒了'); <BR>}); <BR>}) <BR>$('#Button2').bind('click', function () { <BR>$('img').fadeIn(2000, function () { <BR>$('# Button2').val('有了'); <BR>}); <BR>}) <BR>$('#Button3').bind('click', function () { <BR>$(' img').fadeTo(2000, 0.3, function () { <BR>alert('動畫執行完畢'); <BR>}); <BR>}) <BR>}) <BR></script> <br> <br> <br><div> <br><div> <br><input id="Button1" type="button" value="淡出"><input id="Button2" type="button" value="淡入"><input id="Button3" type="button" value="指定透明度"> </div> <br><div><img src="images/1.jpg" class="imgclass" alt="jQuery寫fadeTo範例程式碼_jquery" ></div> </div> </div>