[ColorBoxライブラリ] スライドのタイトルを指定する

説明

ColorBoxライブラリでスライドのタイトルを指定するにはaタグのtitle属性に表示したいタイトルを指定します。また、常に同じタイトルにしたい場合にはcolorbox()メソッドのオプションパラメータtitleに表示するタイトル文字を指定します。

サンプルプログラム

【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/colorbox.css" type="text/css">
<!--[if IE]>
<link type="text/css" rel="stylesheet" href="css/colorbox-ie.css" title="example" />
<![endif]-->
<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.colorbox-min.js"></script>
<script type="text/javascript" src="js/sample.js"></script>
</head>
<body>
<h1>ColorBoxサンプル</h1>
<div>
<a href="photo/1.jpg" class="slideshow" title="松本城"><img src="thumb/1.jpg"></a>
<a href="photo/2.jpg" class="slideshow" title="浅間山"><img src="thumb/2.jpg"></a>
<a href="photo/3.jpg" class="slideshow" title="しゃくなげ"><img src="thumb/3.jpg"></a>
<a href="photo/4.jpg" class="slideshow" title="牡丹"><img src="thumb/4.jpg"></a>
</div>
</body>
</html>


【sample.js】
$(function(){
$(".slideshow").colorbox({
title : "My Album 2009"
});
})
サンプルを実行
[戻る]