Lightbox は prototype.js および scriptaculous.js の effect ライブラリを利用して、サムネイル画像クリック→大きなサイズの元画像表示の動作にエフェクトを加えて、画像をお洒落に表示する JavaScript。
<script type="text/javascript" src="(任意のディレクトリ)/prototype.js"></script> <script type="text/javascript" src="(任意のディレクトリ)/scriptaculous.js?load=effects"></script> <script type="text/javascript" src="(任意のディレクトリ)/lightbox.js"></script> <link rel="stylesheet" href="(任意のディレクトリ)/lightbox.css" type="text/css" media="screen" />
リンクタグに rel="lightbox" を追加します <a rel="lightbox" title="my caption" href="http://www.peacock-union.com/wp-content/rabi.jpg"> <img alt="TrendSetter" src="http://www.peacock-union.com/wp-content/rabi.thumbnail.jpg" /></a> スライドショーライクな表示方法 前段4でリンクタグに挿入した rel="lightbox" を rel="lightbox[roadtrip]" に変更します。 <a title="日本の妖怪その1" rel="lightbox[roadtrip]" href="http://www.peacock-union.com/wp-content/image_01.jpg"><img alt="日本の妖怪その1" src="http://www.peacock-union.com/wp-content/image_01.thumbnail.jpg" /></a> <a title="日本の妖怪その2" rel="lightbox[roadtrip]" href="http://www.peacock-union.com/wp-content/image_02.jpg"><img alt="日本の妖怪その2" src="http://www.peacock-union.com/wp-content/image_02.thumbnail.jpg" /></a> <a title="日本の妖怪その3" rel="lightbox[roadtrip]" href="http://www.peacock-union.com/wp-content/image_03.jpg"><img alt="日本の妖怪その3" src="http://www.peacock-union.com/wp-content/image_03.thumbnail.jpg" /></a> <a title="日本の妖怪その4" rel="lightbox[roadtrip]" href="http://www.peacock-union.com/wp-content/image_04.jpg"><img alt="日本の妖怪その4" src="http://www.peacock-union.com/wp-content/image_04.thumbnail.jpg" /></a> <a title="日本の妖怪その5" rel="lightbox[roadtrip]" href="http://www.peacock-union.com/wp-content/image_05.jpg"><img alt="日本の妖怪その5" src="http://www.peacock-union.com/wp-content/image_05.thumbnail.jpg" /></a> ![]() ![]() ![]() ![]() ![]() |
Archives >