[loupe | a jQuery image magnifierライブラリ] 画像の一部を拡大して表示する(虫眼鏡/ルーペ)

説明

loupe | a jQuery image magnifierライブラリで画像の一部を拡大して表示するにはimgタグで実画像よりも小さいサイズをwidthとheightで指定しておきます。この画像を表示するimgタグにはIDなどを割り当てておきます。$()で拡大表示したい画像を指定しloupe()メソッドを呼び出します。

サンプルプログラム

【HTML】
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="ja">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
<link rel="stylesheet" href="css/main.css" type="text/css" media="all">
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js/jquery.loupe.js"></script>
<script type="text/javascript" src="js/sample.js"></script>
</head>
<body>
<h1>jQuery loupe</h1>
<p>画像の上にマウスを乗せると拡大表示されます。</p>
<img src="images/photo.jpg" id="myPhoto" width="204" height="136">
</body>
</html>

【sample.js】
$(function(){
$("#myPhoto").loupe();
});
サンプルを実行
[戻る]