Website acï thök ë thök ë thök. Na nɔŋ kë cë ŋic, ke yïn lëu ba athör ë thoŋ ë Liŋëlith tïŋ.
Luɔɔi de Käŋ
Tääu ë wël ke Gridzy në thäätku yiic ku tääu keek në wɛbthait du yic (akölriëc në thäät yiic):
<link rel="stylesheet" href="gridzy/gridzy.min.css" />
<script src="gridzy/gridzy.min.js"></script>Tääu ë HTML ë thäät yiic (tënë tɔ̈u ë guɔ̈p yic):
<div class="gridzy">
<img src="https://loremflickr.com/640/480?random=1" alt="a random image" />
<img src="https://loremflickr.com/480/640?random=2" alt="another random image" />
<img src="https://loremflickr.com/640/640?random=3" alt="yet another random image" />
<img src="https://loremflickr.com/640/480?random=4" alt="a random image again" />
<img src="https://loremflickr.com/640/480?random=5" alt="one last random image" />
</div>Yen ëya! Yen ee nyooth de luɔi ëbɛ̈n. Acïn jɔ̈k dɛ̈t wïc.
Tɛ̈u ë käŋ thïn
Dhöl wën lëu bïn Gridzy tääu thïn ee, ba kä ë HTML ë thäät ë thäät ë thäät ë thäät. Yïn awïc ba rin ke kä cïke lɔc tääu tueŋ kenë data-gridzy- . Ku, ba kë spaceBetween looi, juak data-gridzy-spaceBetween .
<div class="gridzy" data-gridzy-spaceBetween="20" data-gridzy-desiredHeight="400">
<img src="https://loremflickr.com/640/480?random=1" alt="a random image" />
<img src="https://loremflickr.com/480/640?random=2" alt="another random image" />
<img src="https://loremflickr.com/640/640?random=3" alt="yet another random image" />
<img src="https://loremflickr.com/640/480?random=4" alt="a random image again" />
<img src="https://loremflickr.com/640/480?random=5" alt="one last random image" />
</div>Käk ë ke lɔc
Justified Kä cïke lɔc
Waterfall Käk cïke lɔc
Kä juëc lɔtueŋ ke lɔc
Të wïc yïn kä juëc ë lööŋ, tïŋ API .
HTML de wël ye keek lueel
Kë thiin koor ë HTML ë Gridzy ee kën:
<div class="gridzy">
<img src="https://loremflickr.com/640/480?random=1" alt="a random image" />
<img src="https://loremflickr.com/480/640?random=2" alt="another random image" />
<img src="https://loremflickr.com/640/640?random=3" alt="yet another random image" />
<img src="https://loremflickr.com/640/480?random=4" alt="a random image again" />
<img src="https://loremflickr.com/640/480?random=5" alt="one last random image" />
</div>Ku na yïn ya, ke Gridzy ee tɔ̈ ke cë thök apɛi ku yïn alëu ba thök ë thök ë HTML kɔ̈k ëbɛ̈n ya luɔ̈ɔ̈i. Anɔŋ kä lik ëke lëu bïk kek ya tak:
- Töŋ de mɛnh de käke tɔ̈ɔ̈u ee kë tök nyuɔɔth në grid yic.
- Käk ë tɔ̈ɔ̈u ku mïthke aalëu bïk ya gɛɛr de dhöl de tag, cït mɛn de
ulkuli(thööŋë ëya dɛ̈t ba kä thɛɛr ke browser dhuɔ̈kciëën). - Na ye kë de
imgcie mɛnh ë rot, ke ka kɔɔr thura degridzyImage.
Ku kën ee dhöl ë luɔi HTML ëya dɛ̈t:
<ul class="gridzy">
<li>
<span>
<img class="gridzyImage" src="https://loremflickr.com/640/480?random=1" alt="a random image" />
</span>
</li>
<li>
<span>
<img class="gridzyImage" src="https://loremflickr.com/480/640?random=2" alt="another random image" />
</span>
</li>
<li>
<span>
<img class="gridzyImage" src="https://loremflickr.com/640/640?random=3" alt="yet another random image" />
</span>
</li>
<li>
<span>
<img class="gridzyImage" src="https://loremflickr.com/640/480?random=4" alt="a random image again" />
</span>
</li>
<li>
<span>
<img class="gridzyImage" src="https://loremflickr.com/640/480?random=5" alt="one last random image" />
</span>
</li>
</ul>Tɛ̈dë ke yïn wïc ba wël ë lëk juak thïn, yïn awïc dhöl ë HTML ë tɔ̈u tueŋ. Të wïc yïn ba kä juëc ŋic në yeen, tïŋ Kä cï Gɔ̈t & Kä cï Gɔ̈t .
Kä ye keek gɔ̈t & Dɛ̈l
Na wïc ba wël ë thööŋ tääu thïn në thööŋdu yic, yïn awïc ba thööŋ de thööŋ ë thööŋ ë thööŋ. Ku na yïn ya, ke dhɔ̈l kɔ̈k cï kek tääu tueŋ aye tɔ̈. Kuat ë dhöl ë CSS ë thäät. Yïn awïc ba athör kënë mat thïn në athör dït ke Gridzy yiic (ye lac tɔ̈ në thök de nhom):
<link rel="stylesheet" href="gridzy/skins/gridzySkinClassic/style.min.css" />Ku ŋoot ke yïn awïc dhöl dït de HTML:
<div class="gridzy gridzySkinClassic">
<figure>
<img class="gridzyImage" src="https://loremflickr.com/640/480?random=1" alt="a random image" />
<figcaption class="gridzyCaption">a caption text</figcaption>
</figure>
<figure>
<img class="gridzyImage" src="https://loremflickr.com/480/640?random=2" alt="another random image" />
<figcaption class="gridzyCaption">another caption text</figcaption>
</figure>
<figure>
<img class="gridzyImage" src="https://loremflickr.com/640/640?random=3" alt="yet another random image" />
<figcaption class="gridzyCaption">yet another caption text</figcaption>
</figure>
<figure>
<img class="gridzyImage" src="https://loremflickr.com/640/480?random=4" alt="a random image again" />
<figcaption class="gridzyCaption">a caption text again</figcaption>
</figure>
<figure>
<img class="gridzyImage" src="https://loremflickr.com/640/480?random=5" alt="one last random image" />
<figcaption class="gridzyCaption">one last caption text</figcaption>
</figure>
</div>Na yïn ë thïïc në dhöl ë HTML, ke yïn tïŋ HTML ë wël ë thok .
Në këde kë cï gɔ̈t yïn alë ba gɛɛr de kë cï gɔ̈t luɔ̈ɔ̈i, tïŋ ëya dɛ̈t lɔn nɔŋ yen kë cï gɔ̈t gridzyCaption . Kë ye cɔl img akɔɔr thura de gridzyImage .
Kë cï nyuɔɔth nhial ëtënë ee yïn nyuɔɔth lɔn ye yïn gridzySkinClassic . Të wïc yïn ba kë wääc luɔ̈ɔ̈i, ke yïn waar rin ke dɛ̈l në töŋ de kee käkë:
Anɔŋic Dɛ̈l
| Piööc tɔ̈u | |
|---|---|
| Dɛ̈l cïn kë tɔ̈u thïn jɔ̈k path de cak de dɛ̈l de rɔt tïŋ de kä pïr | gridzySkinBlank |
| gridzySkinClassic tïŋ de kä pïr | gridzySkinClassic(ACÏ PUƆI jɔɔk në thɛɛr ke 2.6.0) |
| gridzySkinFullOverlay tïŋ de kä pïr | gridzySkinFullOverlay(ACÏ PUƆI jɔɔk në thɛɛr ke 2.6.0) |
| gridzySkinLift tïŋ de kä pïr | gridzySkinLift(ACÏ PUƆI jɔɔk në thɛɛr ke 2.6.0) |
| gridzySkinMagnifier luɔɔi de zoom acie mat thïn tïŋ de kä pïr | gridzySkinMagnifier(ACÏ PUƆI jɔɔk në thɛɛr ke 2.6.0) |
Käk ë thäät tɔ̈ nhial ëbɛ̈n aa wïc athör CSS ëya, ku anɔŋ käk kɔ̈k ë thäät kɔ̈k wïc athör JavaScript ëya dɛ̈t:
<link rel="stylesheet" href="gridzy/skins/gridzySkinBlur/style.min.css" />
<script src="gridzy/skins/gridzySkinBlur/script.min.js"></script>| Piööc tɔ̈u | |
|---|---|
| gridzySkinBlur acie luui në IE tïŋ de kä pïr | gridzySkinBlur(ACÏ PUƆI jɔɔk në thɛɛr ke 2.6.0) |
| gridzySkinCard tïŋ de kä pïr | gridzySkinCard(ACÏ PUƆI jɔɔk në thɛɛr ke 2.6.0) |
Kä ye Dɛ̈l lɔc
Tënë 2.6.0 anɔŋ Käk ë Lööŋ bïk käk cï yïk thïn tääu-pïny. Cït mɛn de gup ë thäät ë thäät yïn alëu ba thäät ë thäät, thäät ë gɛ̈tgɛ̈t ku gɛ̈tgɛ̈t ë thäät tääu. Yïn adhil ba CSS ë thäät ë thäät ë thäät ë thäät ë thäät ë thäät ë thäät:
<div class="gridzy gridzySkinClassic" style="--background: rgba(0, 80, 117, .8); --color: rgb(238, 238, 238); ">
<figure>
<img class="gridzyImage" src="https://loremflickr.com/640/480?random=1" alt="a random image" />
<figcaption class="gridzyCaption">a caption text</figcaption>
</figure>
<figure>
<img class="gridzyImage" src="https://loremflickr.com/480/640?random=2" alt="another random image" />
<figcaption class="gridzyCaption">another caption text</figcaption>
</figure>
...
</div>Tïŋ kä wääc cï keek kuɔɔny ku kä tɔ̈u thïn tënë ayï dɛ̈l ëtënë:
gridzySkinClassic
| Kä wääc | Kë tɔ̈u thïn | Wël |
|---|---|---|
--background | rgba(0, 0, 0, .7) | pɛ̈l gɛɛr de CSS tɔ̈u ciëën |
--color | rgb(255, 255, 255) | pɛ̈l gɛɛr de CSS kïït thöŋ |
--text-shadow | none | päl gɛɛr de kë cï gɔ̈t-atiɛ̈p de CSS |
gridzySkinFullOverlay
| Kä wääc | Kë tɔ̈u thïn | Wël |
|---|---|---|
--background | rgba(0, 0, 0, .7) | pɛ̈l gɛɛr de CSS tɔ̈u ciëën |
--color | rgb(255, 255, 255) | pɛ̈l gɛɛr de CSS kïït thöŋ |
--text-shadow | none | päl gɛɛr de kë cï gɔ̈t-atiɛ̈p de CSS |
gridzySkinLift
| Kä wääc | Kë tɔ̈u thïn | Wël |
|---|---|---|
--background | rgba(0, 0, 0, .7) | pɛ̈l gɛɛr de CSS tɔ̈u ciëën |
--color | rgb(255, 255, 255) | pɛ̈l gɛɛr de CSS kïït thöŋ |
--text-shadow | 0 0 10px rgb(0, 0, 0), 0 0 20px rgb(0, 0, 0), 0 0 30px rgb(0, 0, 0) | päl gɛɛr de kë cï gɔ̈t-atiɛ̈p de CSS |
gridzySkinMagnifier
| Kä wääc | Kë tɔ̈u thïn | Wël |
|---|---|---|
--background | rgba(0, 0, 0, .7) | pɛ̈l gɛɛr de CSS tɔ̈u ciëën |
--color | rgb(255, 255, 255) | pɛ̈l gɛɛr de CSS kïït thöŋ |
Ye dɛ̈l kënë acie --text-shadow ye kuɔɔny
gridzySkinBlur
| Kä wääc | Kë tɔ̈u thïn | Wël |
|---|---|---|
--background | rgba(0, 0, 0, .7) | pɛ̈l gɛɛr de CSS tɔ̈u ciëën |
--color | rgb(255, 255, 255) | pɛ̈l gɛɛr de CSS kïït thöŋ |
--text-shadow | 0 0 10px rgb(0, 0, 0) | päl gɛɛr de kë cï gɔ̈t-atiɛ̈p de CSS |
gridzySkinCard
| Kä wääc | Kë tɔ̈u thïn | Wël |
|---|---|---|
--background | rgba(0, 0, 0, 1) | pɛ̈l gɛɛr de CSS tɔ̈u ciëën |
--color | rgb(255, 255, 255) | pɛ̈l gɛɛr de CSS kïït thöŋ |
--text-shadow | none | päl gɛɛr de kë cï gɔ̈t-atiɛ̈p de CSS |
Kä cï keek lueel wënthɛɛr kedhie aye wël thii cï keek gɔ̈t kuɔɔny abac. Yïn alëu ba dhɔ̈lku cak ku dhɔ̈l juëc ril yiic. Yïn lëu ba tïŋ në dhöl de Gridzy .
Dhɔ̈l Gridzy
Na cïn ë dhöl cï tääu tueŋ thöŋ ke kä wïc keek, yïn alëu ba dhöldu looi.
Dhöl piɔlic ee ba dhöl tɔ̈u ëmɛn thɔ̈ɔ̈ŋ ku thɔ̈ɔ̈ŋë keek në kä wïc keek. Kë cï lueel wënthɛɛr ë gridzySkinBlank de nhom abï lac tɔ̈u ke ye kën puɔth ë jɔ̈k ku jal yaa athör puɔth ë CSS yic:
/** SKIN Blank **/
/* all gallery items (direct children of the main container element) */
.gridzySkinBlank > .gridzyItem {
overflow: hidden;
}
/* all gallery images (predefined in Gridzy's main CSS file, but can be overridden) */
.gridzySkinBlank .gridzyImage {
}
/* all gallery captions (just create your very own style) */
.gridzySkinBlank .gridzyCaption {
margin: 0;
padding: .5em;
opacity: 0;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
position: absolute;
z-index: 1;
top: 0;
left: 0;
width: 100%;
height: 100%;
box-sizing: border-box;
transition: opacity .5s;
overflow: auto;
background: rgba(0, 0, 0, .7);
color: rgb(255, 255, 255);
}
.gridzySkinBlank > .gridzyItem:hover .gridzyCaption {
opacity: 1;
}Në wereŋ de CSS yic yïn abï yök ke ye kën tɔ̈u gridzySkinBlank , gridzyImage ku gridzyCaption . Gridzy ë rot acie wïc në kee piööc käkë. Aye keek luɔ̈ɔ̈i ë thäät yiic ku këya yïn alëu ba keek nyaai wala ba keek waar rin të wïc yïn keek.
Në kë mɛtë thïn yïn abï CSS yök ë thëm de gridzyItem . Gridzy acï ye piööc kënë looi yetök tënë mïth kedhie ke kë tɔ̈u në kë dït yic. Yen, yïn alëu ba thëm kënë luɔ̈ɔ̈i ba käŋ ë thëmdu thɔ̈ɔ̈ŋ.
Kä thiekiic ke nhom
- Kä tɔ̈ thïn ë kë yic akɔɔr bïk ya thök ë thök. Tïŋ lɔn bï dït de kë tɔ̈ thïn rot waar. Luɔ̈ɔ̈i ë thööŋ de bɔɔtic ke cie thööŋ de pixel. Ku yök ë thäät ë thäät ë Gridzy
autoFontSize, ye thäät ë thäät ë thäät ë thäät ë thäät ë thäät ë thäät ë thäät. - Këriɛ̈ɛ̈c ëbën adhil naŋ thööŋ cï juiir apath. Aciëŋ de kë tɔ̈ thïn acïï bï rot waar ku ka kɔɔr bï thëm de grid yup. Ku na ye këdɛ̈ŋ cïï rot ye looi yetök ke nɔŋ thööŋ de thööŋ cï juiir apath, ke yïn thɔ̈ɔ̈ŋë yeen në yï cin (cïmën në css).
Në thɛɛr kɔ̈k yiic, alëu bï yic riɛl bï kä tɔ̈ thïn ya tääu në style yic ke Gridzy këc jɔ̈k. Tääu ë gridzy ë thäät ë thäät ë thäät ë thäät ë thäät.
Yen ëya! Yen ë kë wïc ba yï nhom yïk ë rot. Kä juëc ke skins cï keek guiir wënthɛɛr acie kä juëc ke kën ye luɔ̈ɔ̈i.
Ku ka lëu bï naŋ käjuëc të wïc yïn keek ...
Dɛ̈l cï lɔ tueŋ
Gridzy ee kä juëc ke CSS luɔ̈ɔ̈i ke cie gridzyItem yetök. Kä juëc ke keek abï keek tääu ë röt ku yïn alëu ba keek luɔ̈ɔ̈i në styling aya.
Käke Tɔ̈ɔ̈u Dït
| Rin ke thukul | Bakëde luel |
|---|---|
gridzyba looi në yï cin | Gridzy ee käŋ yök yetök kenë ye akutnhom kënë ku jɔl keek jɔɔk. |
gridzyAnimated | Abï looi yetök naa ye kë animate lɔc ye true . Na cï ye piööc kënë tääu në kɔc cin, ke kë cï lɔc animate abï rot looi yetök ke true aya (ke cie na cï tääu në false yic ). |
Käk Piööc
| Rin ke thukul | Bakëde luel |
|---|---|
gridzyItem | Abï tääu ë thää wën cï këdäŋ jɔɔk ë luɔi ë jɔ̈k. Acïï bï ya nyaai. |
gridzyItemInitializing | Abï tääu ë thää wën cï këdäŋ jɔɔk ë luɔi ë jɔ̈k. Abï gër ë gridzyItemReady ë thää ë thää ë thää ë thää ë thää ë thää ë thää. Acie lɔn cï thura ëbɛ̈n thöl (tïŋ gridzyItemLoading ), ku kë cï tääu thïn acï guiir bï tïŋ. |
gridzyItemReady | Bï gridzyItemInitializing waar ë thäät ë thäät ë thäät ë thäät ë thäät. Acïï bï ya nyaai. Acie kë ye nyuɔɔth lɔn cï thura ëbɛ̈n thöl (tïŋ gridzyItemComplete ), ku kë cï thök acï thök bï tïŋ. |
gridzyItemLoading | Abï tääu ë thää wën cï këdäŋ jɔɔk ë luɔi ë jɔ̈k. Abï waar në gridzyItemComplete cït mɛn cïnë thura tɔ̈ thïn (ye lac ya tök) cï thök ë thök. |
gridzyItemComplete | Abï gridzyItemLoading waar cït mɛn cïnë thura tɔ̈ thïn (ye lac ya tök) cï thök ë thök. Acïï bï ya nyaai. |
gridzyItemInitialToVisible | Abï tääu ë thää wën cï kë cï yök jɔɔk bï bɛ̈n bei ë thää tueŋ. Abï nyaai ë thää wën cï kë cï yök ëbɛ̈n tïŋ. |
gridzyItemVisible | Abï tääu ë thää wën cï kë cï yök ëbɛ̈n tïŋ. Abï nyaai ëya të cïn kë cï yök jɔɔk bï jäl. |
gridzyItemVisibleToHidden | Abï tääu ë thää wën cï këdäŋ jɔɔk bï jäl. Abï nyaai ë thää wën cï kë cï thiaan ëbɛ̈n thiaan. |
gridzyItemHidden | Abï tääu ë thää wën cï kë cï thiaan ëbɛ̈n thiaan. Abï nyaai ëya të cïn kë cï yök jɔɔk bï bɛ̈n bei. |
gridzyItemHiddenToVisible | Abï tääu ë thää wën cï kë cï yök jɔɔk bï bɛ̈n bei (ke cie bï bɛ̈n bei në thaa tueŋ – tïŋ class gridzyItemInitialToVisible thää tueŋ bï bɛ̈n bei ). Abï nyaai të cï kë cï yök ëbɛ̈n tïŋ. |
gridzyItemVisibleToVisible | Abï tääu ë thää wën cï kë tɔ̈ në grid yic rot waar, ku kë tɔ̈ thïn ë rot ee ku rëër ke tïŋ. Abï nyaai të cïnë thök ë thök ë thök ë thök. |
Në thɛɛr thɛɛr ke luɔi nyuɔɔth ku kä ye nyuɔɔth ke thura ye bɛ̈n ku jäl aye keek tääu tueŋ në Gridzy file CSS dït.
Kek käk cï ke lueel nhial ë CSS ë thäät yiic yïn alëu ba style ë thäät ë luɔidu nyuɔɔth ku thäät ë thäät. Dare tïŋ ë Gridzy ë CSS ë thäät ë thäät, ba kë lëu ba gël deetic. Acïn riɔ̈ɔ̈c, këriɛ̈ɛ̈c ëbën acï gɔ̈t apath thïn.
Cɔk kä ye tääu thïn cɔk piath
Na yïn acï thura juëc luɔ̈ɔ̈i, ka lëu bï ya kë puɔth ba Gridzy kuɔny bï grid lac yïk.
Gël Thuraa ke Lɔ̈ŋ
Gridzy akɔɔr abɛ̈n thööŋ de thura kedhie bï grid yup. Käk yith aye bɛ̈n bei në kä ye röt jat nhial yiic naa cï thuraa kɔ̈k röt guiir ku kɔ̈k këc röt guiir. Na ye thura juëc tɔ̈ thïn, ke kä juëc ye kɔc riɔ̈ɔ̈c alëu bïk ya tɔ̈ në ye kën yic.
Ku bï aciëëk käkë gël, ke yïn tääu ë thëm width ku height käŋ tënë käŋ img kedhiɛ. Athiekic ba thööŋ thöŋ tääu në thööŋ de raan tökic, ku na cie yeen, ke thura abï röt waar. Kä ye keek thɔ̈ɔ̈ŋ aye dït ku bɛ̈ɛ̈r de thura tɔ̈u thïn:
<div class="gridzy">
<img src="https://loremflickr.com/640/480?random=1" width="640" height="480" alt="a random image" />
<img src="https://loremflickr.com/480/640?random=2" width="480" height="640" alt="another random image" />
<img src="https://loremflickr.com/640/640?random=3" width="640" height="640" alt="yet another random image" />
<img src="https://loremflickr.com/640/480?random=4" width="640" height="480" alt="a random image again" />
<img src="https://loremflickr.com/640/480?random=5" width="640" height="480" alt="one last random image" />
</div>Në ye kënë cök ke Gridzy alëu bï grid ya yup ëyadɛ̈ ke këc wïc bï ŋic në dït de thura yic.
Lazy Lööding
Të wïc yïn ba thuraai tɔ̈u të yenë daai thïn ëya dɛ̈t tääu thïn, ke yïn kuany kee käkë cök:
- Tääu
widthkuheightkä ye nyuɔɔth cït mɛn cïnë keek lueel nhial (tïŋ ba kä thöŋ luɔ̈ɔ̈i) - Tääu ë käŋ ëbɛ̈n
srcëdata-gridzylazysrccït mɛn cïnë ye nyuɔɔth piiny ëtënë (na nɔŋ yïn käŋsrcsetëya dɛ̈t, waar keek nëdata-gridzylazysrcset).
<div class="gridzy">
<img data-gridzylazysrc="https://loremflickr.com/640/480?random=1" width="640" height="480" alt="a random image" />
<img data-gridzylazysrc="https://loremflickr.com/480/640?random=2" width="480" height="640" alt="another random image" />
<img data-gridzylazysrc="https://loremflickr.com/640/640?random=3" width="640" height="640" alt="yet another random image" />
<img data-gridzylazysrc="https://loremflickr.com/640/480?random=4" width="640" height="480" alt="a random image again" />
<img data-gridzylazysrc="https://loremflickr.com/640/480?random=5" width="640" height="480" alt="one last random image" />
</div>Në thök ë thök ë thök ë thura abï thök ë thök ë thök ë thök ë thök ë thök ë thök.
Kë ye ajuɛɛr nyuɔɔth
Kë ye nyuɔɔth lɔn yenë luɔi looi ee kë thiin ë thööŋ ë thööŋ ye bɛ̈n bei ke thura ë thööŋ ë thööŋ. Na yïn acï wël ë lëk & käk ë thäät luɔ̈ɔ̈i, ke kë ye nyuɔɔth ë luɔi abï nyuɔɔth ë rot. Ku na cie yeen, ke yïn awïc kä kɔ̈k bï kek ya cɔ̈kpiny:
- Tääu ë
imgëbɛ̈n nëdivyic.
(wɛ̈lɛ̈/ka në gɛɛr de kë dɛ̈t yic – tïŋ HTML de thok në kä juëc) - Tääu ë thura
gridzyImagethïn tënë ayi këimg
<div class="gridzy">
<div><img src="https://loremflickr.com/640/480?random=1" class="gridzyImage" alt="a random image" /></div>
<div><img src="https://loremflickr.com/480/640?random=2" class="gridzyImage" alt="another random image" /></div>
<div><img src="https://loremflickr.com/640/640?random=3" class="gridzyImage" alt="yet another random image" /></div>
<div><img src="https://loremflickr.com/640/480?random=4" class="gridzyImage" alt="a random image again" /></div>
<div><img src="https://loremflickr.com/640/480?random=5" class="gridzyImage" alt="one last random image" /></div>
</div>Në ye kën cök yïn adhil kä ye nyuɔɔth ë luɔi tïŋ të cï thura thää dɔm bïk thök.
Kä ye käŋ dhiim
Kä ye käŋ thɔ̈ɔ̈ŋ në Gridzy aye piath apɛi ku ka ril. Ku na cɔk ya kë ë thëm ë thëm wïc, ka lëu bï ya kë lëu bï ya yök. Kë kɔɔr ëbɛ̈n ee, CSS thiin koor ku kä lik ke HTML ...
Yekënë ee nyooth de luɔɔi:
<div id="myFilterControls">
<button value="*">All</button>
<button value=".animals">Animals</button>
<button value=".architecture">Architecture</button>
<button value=".people">People</button>
</div>
<div class="gridzy" data-gridzy-filterControls="#myFilterControls button">
<img class="animals" src="https://loremflickr.com/640/480/animals?random=1" alt="a random animal image" />
<img class="architecture" src="https://loremflickr.com/640/480/arch?random=1" alt="a random architecture image" />
<img class="people" src="https://loremflickr.com/640/480/people?random=1" alt="a random people image" />
<img class="animals" src="https://loremflickr.com/640/480/animals?random=2" alt="another random animal image" />
<img class="architecture" src="https://loremflickr.com/640/480/arch?random=2" alt="another random architecture image" />
<img class="people" src="https://loremflickr.com/640/480/people?random=2" alt="another random people image" />
<img class="animals" src="https://loremflickr.com/640/480/animals?random=3" alt="yet another random animal image" />
</div>Yen yïk Yeen në Kuɛɛr në Kuɛɛr
1. Tueŋ ɣok awïc dhöl thɛɛr ë HTML ë Gridzy ku tääu rin ke class tënë käŋ kedhiɛ ke gallery agoku keek ya thɔ̈ɔ̈ŋ në thɛɛr kɔ̈k yiic .
<div class="gridzy">
<img class="animals" src="https://loremflickr.com/640/480/animals?random=1" alt="a random animal image" />
<img class="architecture" src="https://loremflickr.com/640/480/arch?random=1" alt="a random architecture image" />
<img class="people" src="https://loremflickr.com/640/480/people?random=1" alt="a random people image" />
<img class="animals" src="https://loremflickr.com/640/480/animals?random=2" alt="another random animal image" />
<img class="architecture" src="https://loremflickr.com/640/480/arch?random=2" alt="another random architecture image" />
<img class="people" src="https://loremflickr.com/640/480/people?random=2" alt="another random people image" />
<img class="animals" src="https://loremflickr.com/640/480/animals?random=3" alt="yet another random animal image" />
</div>Në nyooth kënë yic ɣok aye class tök luɔ̈ɔ̈i tënë ëbɛ̈n. Ku yïn alëu ba thëm juëc looi ëya dɛ̈t tënë kë tök, naa ye kë kënë yök në kä juëc ke thëm.
2. Ku ɣok aacï buttons kɔ̈k mat thïn wën lëu buk käŋ waar yiic ku .
<button value="*">All</button>
<button value=".animals">Animals</button>
<button value=".architecture">Architecture</button>
<button value=".people">People</button>
<div class="gridzy">
<img class="animals" src="https://loremflickr.com/640/480/animals?random=1" alt="a random animal image" />
<img class="architecture" src="https://loremflickr.com/640/480/arch?random=1" alt="a random architecture image" />
<img class="people" src="https://loremflickr.com/640/480/people?random=1" alt="a random people image" />
<img class="animals" src="https://loremflickr.com/640/480/animals?random=2" alt="another random animal image" />
<img class="architecture" src="https://loremflickr.com/640/480/arch?random=2" alt="another random architecture image" />
<img class="people" src="https://loremflickr.com/640/480/people?random=2" alt="another random people image" />
<img class="animals" src="https://loremflickr.com/640/480/animals?random=3" alt="yet another random animal image" />
</div>Në thää ë thää, yïn alëu ba kä kɔ̈k ë form cït mɛn ë thää ë thää, thää ë radio, thää ë kuany ku kä kɔ̈k.
Cït mɛn lëu bï yïn ye tïŋ, thööŋ de thööŋ de thööŋ ee thööŋ de CSS ë thööŋ. Cït mɛn cï ɣok thök, ke thëm cït kën abï thura thöŋ ke kë cï kuany CSS nyuɔɔth. Në dhöl de teknologï yic, ke ka ye lööŋ ke filter tääu në ye thööŋ kënë yic.
Yïn lëu ba kä juëc ril yiic ëya dɛ̈t luɔ̈ɔ̈i. Në nyooth :not(.animals) abï luui ëya dɛ̈t, ku jal yaa .animals.people ku .animals, .people .
3. Në thök, ɣok aacï thök ë thök tääu në div yic ku tääu keek në thök ë Gridzy, në tɛ̈ɛ̈u ë filterControls :
<div id="myFilterControls">
<button value="*">All</button>
<button value=".animals">Animals</button>
<button value=".architecture">Architecture</button>
<button value=".people">People</button>
</div>
<div class="gridzy" data-gridzy-filterControls="#myFilterControls button">
<img class="animals" src="https://loremflickr.com/640/480/animals?random=1" alt="a random animal image" />
<img class="architecture" src="https://loremflickr.com/640/480/arch?random=1" alt="a random architecture image" />
<img class="people" src="https://loremflickr.com/640/480/people?random=1" alt="a random people image" />
<img class="animals" src="https://loremflickr.com/640/480/animals?random=2" alt="another random animal image" />
<img class="architecture" src="https://loremflickr.com/640/480/arch?random=2" alt="another random architecture image" />
<img class="people" src="https://loremflickr.com/640/480/people?random=2" alt="another random people image" />
<img class="animals" src="https://loremflickr.com/640/480/animals?random=3" alt="yet another random animal image" />
</div>Cït mɛn lëu bï yïn ye tïŋ, ɣok aa lëu buk CSS ë kuɛ̈ny ë thäät ë thäät filterControls . Kë tɔ̈u thïn div nɔŋ id ë thäät ë luɔi ëya dɛ̈t bï thäät ë thäät ë thäät ë thäät ë thäät ë CSS kuany.
Yen ëya!
Na wïc kë bï yïn yök, tïŋ API .
API
Na cɔk Gridzy naŋ API de, kä juëc alëu bï kek ya looi ke cïn yen, në thööŋ de DOM. Gridzy abï ye tïŋ ku tɛ̈ɛ̈u ë gël. Ku anɔŋ API ril apɛi ëya dɛ̈t ...
Ba DOM gël
Në këde käke Gät kedhie ke Käke Luɔɔi (DOM) ke wɔ kɔɔr käke tɔ̈ɔ̈u tueŋ:
// get the container element
var gridzyElement = document.querySelector('.gridzy');Thura juak thïn
Athiekic ba yïk ëbɛ̈n ku thiöŋë kë yam de meth ke yïn këc tääu në kë de tɔ̈ɔ̈u yic. Ku na cie yeen, ke Gridzy acïï lëu bï thëm de käŋ ya yök.
// create a new img element
var newImage = document.createElement('img');
// add src attribute (!! before you add it to the container element !!)
newImage.src = 'https://loremflickr.com/640/480';
// add it as last element to the container element
gridzyElement.appendChild(newImage);
// or as first element (or anywhere in between)
gridzyElement.insertBefore(newImage, gridzyElement.firstChild);Nyaai Thura
// remove the first image
gridzyElement.removeChild(gridzyElement.firstElementChild);Gɛɛr kä bïke lɔc
// change the spaceBetween option to a specific value
gridzyElement.setAttribute('data-gridzy-spaceBetween', '10');
// change the layout option to a specific value
gridzyElement.setAttribute('data-gridzy-layout', 'waterfall');
// reset the spaceBetween option to its default value
gridzyElement.removeAttribute('data-gridzy-spaceBetween');Kä juëc në këde gël de DOM yïn lë ba yök në wereek ke wɛbthait de MDN . Anɔŋ ëya dɛ̈t ë jɔ̈k de DOM tɔ̈u.
API de raan ëbɛ̈n
Tënë bï API luɔ̈ɔ̈i, ɣok aa wïc kë tueŋ de Gridzy, ye tɔ̈u ke cï mat ke kë tɔ̈u në Gridzy yic:
// get the Gridzy instance
var gridzyInstance = document.querySelector('.gridzy').gridzy;Yök Kë bï lɔc
// get the value of a single option
var currentLayout = gridzyInstance.getOption('layout');Yök Käŋ ëbɛ̈n
// get all option values as an object
var currentOptions = gridzyInstance.getOptions();Tääu ë kä bï ke lɔc
// set specific option values
gridzyInstance.setOptions({
spaceBetween: 10,
layout: 'waterfall'
});
// or reset options to their default values
gridzyInstance.setOptions({
spaceBetween: null,
layout: null
});Luɔɔi kë ye käŋ dhiim
Luɔɔi de kë ye käŋ dhiim ee filter ye käŋ dhiim looi ëya dɛ̈t lëu bï ya gɛɛr de kë ye CSS kuany:
// set the filter to match items with class "animals"
gridzyInstance.setOptions({
filter: '.animals'
});
// reset the filter to match all items again
gridzyInstance.setOptions({
filter: '*'
});
// set the filter to match items without class "animals"
gridzyInstance.setOptions({
filter: ':not(.animals)'
});
// set the filter to match items with class "animals" or "people"
gridzyInstance.setOptions({
filter: '.animals, .people'
});
// set the filter to match items that have both classes, "animals" and "people"
gridzyInstance.setOptions({
filter: '.animals.people'
});Tääu ë Luɔɔi de Cɔl Dhukciëën
ACÏ THƆƆ̈Ŋ jɔɔk në thɛɛr ke 2.4.0
Luɔ̈ɔ̈i ë kä yam ku kä juëc ë thäät ë thäät ë thäät. Tïŋ ë thäät kɔ̈k yiic ku yök wël juëc.
Gridzy.js 2 ee kä kɔ̈k ë lööŋ ë thäät ë thäät ë thäät ë thäät ë thäät. Alëu bïk ya tääu në API de raan ëbɛ̈n yic, ku cït mɛn de kä kɔ̈k lëu bïk kek ya lɔc:
// same as set other options
gridzyInstance.setOptions({
onOptionsChanged: function() {
// will be executed each time the options have changed.
},
onBeforeOptionsChanged: function() {
// will be executed, before new options take effect.
}
});Luɔ̈ɔ̈i kä cï röt looi
jɔɔk në thɛɛr ke 2.4.0
Yïn lë ba käke Gridzy luɔ̈ɔ̈i cït mɛn de käke JavaScript:
document.addEventListener('gridzyOptionsChanged', function(event) {
// will be executed each time the options have changed.
});
document.addEventListener('gridzyBeforeOptionsChanged', function(event) {
// will be executed, before new options take effect.
});Kä kɔ̈k aye keek mac në kë de Gridzy ku kä kɔ̈k aye keek mac në kë de raan tök tɔ̈ në kë de käŋ yic.
Kä cï röt looi në këde Gridzy:
event.target përïvës ë Grïdzy cöntäïnë ëlëmën.
event.detail.instance cï röt looi Gridzy.
Kä cï röt looi cï keek mac në käŋ yiic:
event.target përësïf ïtëm ïtëm ëlëmën.
event.detail.instance cï röt looi Gridzy.
API – Pinynhom
Anɔŋ kä kɔ̈k ye luui ë ke lääu tënë kä ye röt looi ke Gridzy. Ku ɣok aacïï wïc buk käŋ yök tueŋ.
Yök kë cï lɔc thɛɛr
// get the default value of a single option
var defaultLayout = Gridzy.getDefaultOption('layout');Yök Kä cïke lɔc kedhie
// get all default option values as an object, including the default layout options of the default layout
var defaultOptions = Gridzy.getDefaultOptions();
// or get all default option values, including the default layout options of a specific layout
var defaultOptions = Gridzy.getDefaultOptions('waterfall');Tääu ë Kä cïke lɔc
Yekënë acie kä cï ke lɔc kedhie cï keek jɔɔk wënthɛɛr ke Gridzy looi, ku ee kën tɔ̈u në kä yam yiic lueel. Naa cak tɔ̈u, naa cï kë cï kuany de kë tɔ̈u wënthɛɛr dhuɔ̈kciëën në këde null , abï kë yam de kë tɔ̈u thïn luɔ̈ɔ̈i.
// set default option values
Gridzy.setDefaultOptions({
spaceBetween: 10,
layout: 'waterfall'
});Yïn alëu ba kën luɔ̈ɔ̈i ba käŋ tääu piny pinynhom, të cï yïn ye cɔl ke DOM këc thök. Ku yïn acïï bï wïc ba kä cïke lɔc looi cït mɛn de kä ye nyuɔɔth.
Kä ye röt looi keepɛ̈i
Të ŋoot ë käŋ ëbɛ̈n ë Gridzy.js 2 ë luɔi, acïn kë wïc ë dhɔ̈l tɔ̈ piiny. Ku kä ye röt looi keepɛ̈i alë bï keek cɔk thök bïk Gridzy luɔ̈ɔ̈i në kueer thɛɛr:
// disable automatic initializations
Gridzy.setDefaultOptions({
autoInitOnDomReady: false,
autoInitOnDomMutation: false
});
// or switch off all mutation observers
Gridzy.setDefaultOptions({
autoInitOnDomMutation: false,
autoSyncChildListMutation: false,
autoSyncAttributesMutation: false,
autoSyncChildClassMutation: false,
autoSyncImageMutation: false
});Kɔ̈k ke kä cï ke lɔc käkë acïï lë bï keek tääu në data-gridzy- kä ye keek nyuɔɔth wala në setOptions() , acän käke thööŋ:
Jɔ̈k rot në yï cin
// initialize a new Gridzy instance
var gridzyInstance = new Gridzy(document.querySelector('.gridzy'), {
spaceBetween: 10,
layout: 'waterfall'
});Riäk kë cï rot looi
Acï lueel apɛi, kë wääc ke jɔ̈k de Gridzy.
gridzyInstance.destroy();
gridzyInstance = null;Tääu ë rin ke mïth në yï cin
// after child elements (images) are added to or removed from the DOM.
gridzyInstance.syncChildList();Tääu ë Mɛ̈th Tök në Käke Tök
Acïï lac wïc, ee në thɛɛr lik yiic.
// after child elements (images) are added to the DOM and only one of them should be synced to Gridzy.
gridzyInstance.syncChild(childElement);Kä ye nyuɔɔth në yï cin
Tïŋ lɔn ye lööŋ ke useOptionAttributes ë lööŋ ë true ë lööŋ ë lööŋ ë lööŋ.
// after data-gridzy- attributes have changed
gridzyInstance.syncAttributes();Luɔɔi de Riɛl
Acïï lac wïc, naa cak kä ye röt looi keepɛ̈i kedhiɛ ya thiöök nhïïm
gridzyInstance.render();