[Greybox Reduxライブラリ] ウィンドウ内に他ページを表示する

説明

GGreybox Reduxライブラリでウィンドウ内に他ページを表示するには、ウィンドウに表示するaタグを$()で指定します。指定したaタグがクリックされた時にGB_Show()メソッドを呼び出し他ページをウィンドウ上に表示する処理をおこないます。なお、close.gif画像だけはHTMLファイルと同じ階層においておく必要があります。

サンプルプログラム

【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/greybox.css" type="text/css" media="all">
<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/greybox.js"></script>
<script type="text/javascript" src="js/sample.js"></script>
</head>
<body>
<h1>Greybox Reduxサンプル</h1>
<ul>
<li><a href="http://www.openspc2.org" class="greyboxR" title="OpenSpace">OpenSpace</a></li>
<li><a href="http://www.yahoo.co.jp" class="greyboxR" title="Yahoo">Yahoo</a></li>
<li><a href="http://www.rakuten.co.jp" class="greyboxR" title="楽天市場">楽天市場</a></li>
</ul>
</body>
</html>

【sample.js】
var GB_ANIMATION = true;
$(function(){
$(".greyboxR").click(function(){
var t = this.title || $(this).text() || this.href;
GB_show(t,this.href,470,600);
return false;
});
});
サンプルを実行
[戻る]