Gridzy.Gallery
JavaScript 庫

我搵到最驚喜嘅相片體驗。終於有人明白點樣做到呢一點!

米洛 · 佩西奇 – 圖書館嘅使用者

快速洞察

1 分鐘影片教學

只需一分鐘就可以學到呢樣嘢:

基本用法

配置

過濾器

外表

慶祝呢一日
錫你嘅愛人
對自己保持純潔
唔好唔記得個樂趣
感受大自然

字幕樣式

預先定義嘅字幕樣式,方便快速解決

將滑鼠游標移到圖片上面,就可以睇到設定咗嘅字幕樣式。用啲掣同顏色選擇器嚟設定顯示嘅內置樣式。

標籤同篩選器

以更有結構嘅方式顯示你嘅圖片

內置嘅過濾系統非常靈活。 CSS 選擇器用嚟過濾嘅事實實際上幾乎可以啟用任何類型嘅過濾器。

高度兼容

可以同好多燈箱一齊用

將圖庫同任何燈箱結合。佢兼容嘅機率差唔多係100 % 。撳一下圖片就可以睇到 PhotoSwipe 燈箱作為例子。

有啲網誌文章有現成嘅程式碼片段:

高度靈活

慶祝呢一日
錫你嘅愛人
對自己保持純潔
唔好唔記得個樂趣
感受大自然

建立自訂樣式

如果你熟悉 CSS ,你可以按照你想要嘅方式設計圖庫項目。

所示例子嘅 CSS :

/* CSS class: "gridzySkin-custom-sepia" */

@property --gridzySkin-custom-sepia--filter-sepia {
	initial-value: 1;
	inherits: true;
	syntax: "<number>";
}
@property --gridzySkin-custom-sepia--filter-contrast {
	initial-value: 1;
	inherits: true;
	syntax: "<number>";
}

.gridzySkin-custom-sepia > .gridzyItem {
	position: relative;
	overflow: unset;
	margin: -10px;
	border: 10px solid #fff;
	box-shadow: 1px 1px 5px rgba(0, 0, 0, .5);
	border-radius: 10px;
}

.gridzySkin-custom-sepia > .gridzyItem *:not(.gridzyCaption) {
	display: inline;
}

.gridzySkin-custom-sepia > .gridzyItem .gridzyCaption * {
	display: initial;
}

.gridzySkin-custom-sepia > .gridzyItem:nth-child(4n) {
	transform: rotate(-1deg);
}

.gridzySkin-custom-sepia > .gridzyItem:nth-child(4n+1) {
	transform: rotate(-.5deg);
}

.gridzySkin-custom-sepia > .gridzyItem:nth-child(4n+2) {
	transform: rotate(1deg);
}

.gridzySkin-custom-sepia > .gridzyItem:nth-child(4n+3) {
	transform: rotate(.5deg);
}

.gridzySkin-custom-sepia .gridzyImage {
	position: relative;
	vertical-align: middle;
	border-radius: 3px;

	--gridzySkin-custom-sepia--filter-sepia: 1;
	--gridzySkin-custom-sepia--filter-contrast: .7;
	filter: sepia(var(--gridzySkin-custom-sepia--filter-sepia)) contrast(var(--gridzySkin-custom-sepia--filter-contrast));
	transition: --gridzySkin-custom-sepia--filter-sepia .6s, --gridzySkin-custom-sepia--filter-contrast .6s;
}

.gridzySkin-custom-sepia > .gridzyItem:hover .gridzyImage {
	--gridzySkin-custom-sepia--filter-sepia: 0;
	--gridzySkin-custom-sepia--filter-contrast: 1;
}

.gridzySkin-custom-sepia .gridzyCaption {
	margin: 0;
	padding: .5em;
	position: absolute;
	z-index: 1;
	bottom: -.5em;
	top: auto;
	width: auto;
	max-width: calc(100% - 2em);
	height: fit-content;
	max-height: 100%;
	overflow: auto;
	box-sizing: border-box;
	background: rgba(238, 238, 238, .8);
	color: #000;
	box-shadow: 1px 1px 3px rgba(0, 0, 0, .3);
	opacity: 0;
	transition: opacity .3s;
}

.gridzySkin-custom-sepia > .gridzyItem:nth-child(3n) .gridzyCaption {
	transform: translateX(1000px) translateX(-50%) rotate(3deg);
}

.gridzySkin-custom-sepia > .gridzyItem:nth-child(3n+1) .gridzyCaption {
	transform: translateX(1000px) translateX(-50%) rotate(-3deg);
}

.gridzySkin-custom-sepia > .gridzyItem:nth-child(3n+2) .gridzyCaption {
	transform: translateX(1000px) translateX(-50%) rotate(-1deg);
}

.gridzySkin-custom-sepia > .gridzyItem:nth-child(5n) .gridzyCaption {
	left: calc(50% - 1000px);
}

.gridzySkin-custom-sepia > .gridzyItem:nth-child(5n+1) .gridzyCaption {
	left: calc(54% - 1000px);
}

.gridzySkin-custom-sepia > .gridzyItem:nth-child(5n+2) .gridzyCaption {
	left: calc(46% - 1000px);
}

.gridzySkin-custom-sepia > .gridzyItem:nth-child(5n+3) .gridzyCaption {
	left: calc(52% - 1000px);
}

.gridzySkin-custom-sepia > .gridzyItem:nth-child(5n+4) .gridzyCaption {
	left: calc(48% - 1000px);
}

.gridzySkin-custom-sepia > .gridzyItem:hover .gridzyCaption {
	opacity: 1;
}

用任何 HTML

你幾乎可以用任何 HTML 。只有好少限制。呢度顯示嘅例子都會產生相同嘅視覺結果。

例子1:

<ul class="gridzy gridzySkinClassic">
	<li>
		<a href="https://www.example.com/">
			<img class="gridzyImage" src="https://www.example.com/image1.jpg" />
			<span class="gridzyCaption">example caption 1</span>
		</a>
	</li>
	<li>
		<a href="https://www.example.com/">
			<img class="gridzyImage" src="https://www.example.com/image2.jpg" />
			<span class="gridzyCaption">example caption 2</span>
		</a>
	</li>
	...
</ul>

例子2:

<section class="gridzy gridzySkinClassic">
	<figure>
		<img class="gridzyImage" src="https://www.example.com/image1.jpg" />
		<figcaption class="gridzyCaption">example caption 1</figcaption>
	</figure>
	<figure>
		<img class="gridzyImage" src="https://www.example.com/image2.jpg" />
		<figcaption class="gridzyCaption">example caption 2</figcaption>
	</figure>
	...
</section>

更多有用嘅功能

懶人載入

更快載入你睇過嘅圖片

呢個只會載入嗰啲靠近可見區域嘅圖片。所以可見圖像嘅帶寬更多。

API

畀你做多啲嘢

噉樣可以畀你以編程方式加入同移除圖片、更改選項或者對事件作出反應。

擴充功能

為你提供個別情況嘅解決方案

呢個係一個隨時間增長嘅博客文章集合,並且包含有用嘅代碼片段,可以輕鬆擴展Gridzy.Gallery 。

用戶關於圖書館

我哋開始做嘢啦!

撳個掣嚟睇下啲計劃!