画像にマウスオーバーすると画像の一部を拡大表示し、マウスアウトすると拡大表示を非表示にします。
画像をクリックすると画像の一部を左側に拡大表示し、再度クリックすると拡大表示を非表示にします。
<!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>設置サンプル</title> <link rel="stylesheet" type="text/css" href="/content/lib/global.css" /> <!-- JS --> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script> <script type="text/javascript" src="/content/lib/jquery/jquery.magnify-1.0.2.js"></script> <script type="text/javascript"> $(function() { /* 例1:デフォルト */ $("#d1").magnify(); /* 例2:オプション設定 */ $("#d2").magnify({ lensWidth: 60, lensHeight: 60, showEvent: 'click', hideEvent: 'click', preload: false, loadingImage: '/content/lib/galleryimages/loading.gif', stagePlacement: 'left', lensCss: { backgroundColor: '#cc0000', border: '0px', opacity: 0.4 }, stageCss: { border: '4px solid #cc0000' } }); }); </script> <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> <div id="wrap"> <h1>設置サンプル</h1> <p>参照:<a href='http://www.jnathanson.com/index.cfm?page=pages/jquery/magnify/magnify' target="_blank">Magnify, a jQuery plugin</a></p> <!-- CODE --> <h2>例:デフォルト</h2> <p>画像にマウスオーバーすると画像の一部を拡大表示し、マウスアウトすると拡大表示を非表示にします。</p> <a href="http://farm4.static.flickr.com/3239/3032375082_24f44c06ba_o.jpg" id="d1"> <img src="http://farm4.static.flickr.com/3239/3032375082_fd66d11941_m.jpg" width="240" height="180"/> </a> <br><br><br> <h2>例:オプション設定あり</h2> <p>画像をクリックすると画像の一部を左側に拡大表示し、再度クリックすると拡大表示を非表示にします。</p> <div style="padding-left:200px;"> <a href="http://farm4.static.flickr.com/3239/3032375082_24f44c06ba_o.jpg" id="d2"> <img src="http://farm4.static.flickr.com/3239/3032375082_fd66d11941_m.jpg" width="240" height="180" /> </a> </div> <!-- CODE / --> </div> </body> </html>