▼画像にマウスオーバーすると隠しておいたもう1枚の画像が表示され、元画像と交じり合いながら消えていき、元の画像に戻ります。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Language" content="ja" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="imagetoolbar" content="no" /> <title>CSS Tooltips - loadaverageZero | 設置サンプル</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> <script type="text/javascript"> // when the DOM is ready: $(document).ready(function () { // find the div.fade elements and hook the hover event $('div.fade').hover(function() { // on hovering over, find the element we want to fade *up* var fade = $('> div', this); // if the element is currently being animated (to a fadeOut)... if (fade.is(':animated')) { // ...take it's current opacity back up to 1 fade.stop().fadeTo(250, 1); } else { // fade in quickly fade.fadeIn(250); } }, function () { // on hovering out, fade the element out var fade = $('> div', this); if (fade.is(':animated')) { fade.stop().fadeTo(3000, 0); } else { // fade away slowly fade.fadeOut(3000); } }); }); </script> <style type="text/css"> body{ margin:20px; padding:0; font:12px/1.5 verdana,sans-seif; } h1 { font-size:150%; } img { border:0; } /* fade */ .fade { position:relative; top:0; left:0; width:120px; height:160px; display:block; } .fade div { position:absolute; top:0; left:0; display:none; } </style> <link rel="stylesheet" type="text/css" href="/common/css/example.css"></head> <body id='example3' class='example'><div class="ads" style="margin:32px auto;text-align:center;"></div><h1 class='h'><a href='/'>PHP & JavaScript Room</a> :: 設置サンプル</h1> <h3 class='h'>実行結果</h3> <h1><a href='http://jqueryfordesigners.com/image-cross-fade-transition/'>Image Cross Fade Transition</a> | 設置サンプル</h1> <p>▼画像にマウスオーバーすると隠しておいたもう1枚の画像が表示され、元画像と交じり合いながら消えていき、元の画像に戻ります。</p> <div class="fade"> <a href="#"><img src="/content/img/ajax/start.png" /></a> <div> <a href="#"><img src="/content/img/ajax/end.png" /></a> </div> </div> </body> </html>