Title02
Tigermilk
by name
Title03
Houttuynia+cordata
by name
Title05
KRAZY+BALDHEAD
by name
Title11
monochrome
by name
Title12
elroy klee
by name
Title13
Eyes as Big as Plates
Title14
Bellflower
by name
Title15
pandamonium
by name
Title15
RCA secret
by name
Title16
Riitta Ikonen leaf
by name
Title17
Riitta Ikonen leaf
by name
Title18
lastdaydream
by name
Title20
Viviane Sassen
by name
Title21
jopsu ramu
by name
最近、特に女性
に人気があるPinterest(ピンタレスト)。 その人気の秘密のひとつが、そのシンプルでお洒落なデザイン性です。
Pinterest(ピ
ンタレスト)は白地に画像がずらりと並んだビジュアル中心のデザインになっていて、とてもシンプルですが、ファッション誌のようでただ眺めているだけでも
退屈しません。
そのPinterest(ピンタレスト)風に画像を一覧表示させてくれるのが、このjQueryプラグイ
ン「BlocksIt.js」です。
サンプルページを作ってみました。 →
Pinterest(ピ
ンタレスト)風に画像を並べて表示するjQueryプラグイン「BlocksIt.js」サンプル
jQuery
プラグイン「BlocksIt.js」の使用方法は続きをどうぞ。
【使用方法】
まずは、
こちらの本家のサイトからBlocksIt.js
など一式ダウンロードします。
<head>部分にcssとJavaScriptを記述します。
1 | <link rel='stylesheet' href='style.css' media='screen' /> |
2 | <script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> |
3 | <script
type="text/javascript" src="blocksit.js"></script> |
5 | $(document).ready(function() { |
最後に<body>部に画像を記述すれば完成です。
6 | <strong>
タイトル1</strong> |
14 | <strong>タイトル2</strong> |
※オプションがいくつか用意されているので、様々な効果を付けることも可能です。
.BlocksIt(
[Options] )
[Options]
- numOfCol:
Type: Int Default: 5
コラム数を設定します。
- offsetX:
Type: Int Default: 5
ブロックの左右のマージン幅
- offsetY:
Type: Int Default: 5
ブロックの上下のマージン幅
- blockElement:
Type: String Default: ‘div’
オプションの記述の例
1 | $(document).ready(function() { |
2 | $('#container').BlocksIt({ |
以下にサンプルページのソースを書いておきます。サンプルではウィンドウズ幅に応じてコラム数を
変更させています。どうぞご参考までに。
(画像の数が多いので6枚目以降の画像指定の部分は省略しています。)
4 | <title>Pinterest風に画像を並べて表示するjQueryプラグイン
「BlocksIt.js」サンプル │ ぱんにゃっと/H&Y</title> |
5 | <meta name="description"
content="BlocksIt.js jQueryのサンプル by ぱんにゃっと/H&Y"/> |
6 | <meta name="keywords"
content="jquery,blocksit.js,サンプル"/> |
7 | <link rel='stylesheet'
href='style.css' media='screen' /> |
8 | <script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> |
10 | <script
src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> |
12 | <script
src="js/blocksit.min.js"></script> |
14 | $(document).ready(function() { |
16 | $(window).load( function() { |
17 | $('#container').BlocksIt({ |
25 | var currentWidth = 1100; |
26 | $(window).resize(function() { |
27 | var winWidth = $(window).width(); |
32 | } else if(winWidth < 880) { |
35 | } else if(winWidth < 1100) { |
43 | if(conWidth != currentWidth) { |
44 | currentWidth
= conWidth; |
45 | $('#container').width(conWidth); |
46 | $('#container').BlocksIt({ |
62 | <h1>Pinterest風に画像をレイアウトして表示するjQueryプラグイン「BlocksIt.js」サンプ
ル</h1> |
66 | <div class="imgholder"> |
67 | <img
src="img/01.jpg" /> </div> |
68 | <strong>Title01</strong> |
70 | <div class="meta">by name</div> |
73 | <div class="imgholder"> |
74 | <img
src="img/02.jpg" /> </div> |
75 | <strong>Title02</strong> |
77 | <div class="meta">by name</div> |
80 | <div class="imgholder"> |
81 | <img
src="img/03.jpg" /> </div> |
82 | <strong>Title03</strong> |
84 | <div class="meta">by name</div> |
87 | <div class="imgholder"> |
88 | <img
src="img/04.jpg" /> </div> |
89 | <strong>Title04</strong> |
91 | <div class="meta">by name</div> |
94 | <div class="imgholder"> |
95 | <img
src="img/05.jpg" /> </div> |
96 | <strong>Title05</strong> |
98 | <div class="meta">by name</div> |
0 件のコメント :
コメントを投稿