企業情報 │ お問い合わせ │サポート
[ ツールチップの動的配置 ] [ メニュー ] [ オーバレイの Apple 効果]


オーバレイの最小限の設定

下に、オーバレイを始める2つの画像を見ることができます。 使用される2つの用語があります: トリガ は、 オーバレイを始める要素で、オーバレイはページ上に 配置される要素です。

The Barcelona Pavilion

Barcelona, Spain

The Barcelona Pavilion, designed by Ludwig Mies van der Rohe, was the German Pavilion for the 1929 International Exposition in Barcelona, Spain. It was an important building in the history of modern architecture.

Several critics, historians and modernists have declared it "the most beautiful building of the century"

The Barcelona Pavilion

Barcelona, Spain

Another unique feature of this building is the exotic materials Mies chose to use.

Plates of high-grade stone materials like veneers of Tinos verde antico marble and golden onyx as well as tinted glass of grey, green, white, in addition to translucent glass, perform exclusively as spatial dividers.

スタンドアロン・デモ

トリガのHTMLコード

最初に、トリガを次のように定義します:

<img src="thumbs/barcelona-pavilion.jpg" rel="#mies1"/>
<img src="thumbs/barcelona-pavilion2.jpg" rel="#mies2"/>

このトリガは、rel 属性の中にオーバレイ要素への参照を持っています。 この属性は、使用するオーバレイを選択する jQueryセレクタです。 一般的に、セレクタはユニークなidを持つ1つの要素を選択します。 例えば、#mies1 は、"mies1" の id を持っている要素を選択します。

ページには、1つ以上のトリガを持つことができ、各トリガはそれぞれが同じオーバレイや 異なるオーバレイを参照することができます。

注: ここでは button タグを使用しましたが、 rel 属性を持っている限り、トリガとしては任意の要素を使用することができます。 一般的なシナリオは、rel 属性およびネストされた img タグを持つ a タグを使用することです。

オーバレイのHTMLコード

次は、オーバレイが必要です:

<!-- first overlay. id attribute matches our selector -->
<div class="simple_overlay" id="mies1">
  <!-- large image -->
  <img src="photos/barcelona-pavilion-large.jpg" />
 
  <!-- image details -->
  <div class="details">
    <h3>The Barcelona Pavilion</h3>
    <h4>Barcelona, Spain</h4>
    <p>The content ...</p>
  </div>
</div>
 
<!-- second overlay -->
<div class="simple_overlay" id="mies2">
  ...
</div>

オーバレイは、任意のHTML要素にすることができますが、div が最も一般的に使用されます。 オーバレイはフォーム、イメージ、FlashオブジェクトやJavaScriptウィジェットを含む任意のHTMLを含む ことができますが、どのようにそれを構造化してスタイルの設定を行うかは、我々次第です。 これが、このツールが柔軟である理由です。オーバレイとコンテンツの両方を可視化することができます。 まさに、想像力を働かせてください。

CSS コード

ここに、オーバレイされる要素のスタイルがあります。ここで注意すべき点がいくつかあります:

/* オーバレイ要素 */
.simple_overlay {
 
    /* 最初は非表示でなければならない */
    display:none;
 
    /* 他の要素の上にオーバレイを配置する */
    z-index:10000;
 
    /* スタイル設定 */
    background-color:#333;
 
    width:675px;
    min-height:200px;
    border:1px solid #666;
 
    /* 最新ブラウザへの CSS3 スタイル */
    -moz-box-shadow:0 0 90px 5px #000;
    -webkit-box-shadow: 0 0 90px #000;
}
 
/* [閉じる]ボタンを右上隅に配置 */
.simple_overlay .close {
    background-image:url(/media/img/overlay/close.png);
    position:absolute;
    right:-15px;
    top:-15px;
    cursor:pointer;
    height:35px;
    width:35px;
}

ここに、イメージの説明を表示するオーバレイ内の .details 要素の、簡単なスタイルの設定があります:

/* オーバレイ内の要素のスタイル設定 */
  .details {
  position:absolute;
  top:15px;
  right:15px;
  font-size:11px;
  color:#fff;
  width:150px;
  }
 
  .details h3 {
  color:#aba;
  font-size:15px;
  }

JavaScript コード

これは、この設定の中で最も簡単な部分です。 単にトリガ要素を選択し、追加オプションを指定せずにオーバレイを有効にします:

	$("img[rel]").overlay();

Photo credits »


Copyright(c)2005 Your site name All rights reserved. テンプレートby LinkFly