ဗားရှင်း 2.x


အခြေခံအသုံးပြုမှု

Gridzy ဖိုင်များကို သင့်ဆာဗာသို့ အပ်လုဒ်လုပ်ကာ ၎င်းတို့ကို သင့်ဝဘ်ဆိုဒ်သို့ ပေါင်းထည့်ပါ (များသောအားဖြင့် ခေါင်းပိုင်းကဏ္ဍတွင်)။

<link rel="stylesheet" href="gridzy/gridzy.min.css" />
<script src="gridzy/gridzy.min.js"></script>

HTML ကုဒ်ကို ထည့်ပါ (ကိုယ်ထည်ကဏ္ဍရှိ မည်သည့်နေရာတွင်မဆို)

<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>

ဒါပဲ! အဲဒါ အပြည့်အဝ လုပ်ဆောင်နိုင်တဲ့ ဥပမာတစ်ခုပါ။ အပိုအစပြုခြင်းမလိုအပ်ပါ။

ဖွဲ့စည်းမှု

Gridzy ကို configure လုပ်ရန် အလွယ်ကူဆုံးနည်းလမ်းမှာ HTML attribute များကိုသာ အသုံးပြုခြင်းဖြစ်သည်။ သင်သည် data-gridzy- ဖြင့် ရွေးချယ်စရာအမည်များကိုသာ ရှေ့ဆက်ရန် လိုအပ်သည်။ ထို့ကြောင့် spaceBetween option ကိုသတ်မှတ်ရန်၊ attribute 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>

အဓိက ရွေးချယ်စရာများ

မူရင်းတန်ဖိုးဖော်ပြချက်
animatetrueဇယားကွက်ပြောင်းသည့်အခါ ကာတွန်းများကို အသုံးပြုသင့်သလား (ဥပမာ၊ ဘရောင်ဇာဝင်းဒိုးကို အရွယ်အစားပြောင်းသည့်အခါ သို့မဟုတ် စစ်ထုတ်မှုတစ်ခုကို သတ်မှတ်သည့်အခါ)။
layoutjustifiedအသုံးပြုထားသော အပြင်အဆင်ကို သတ်မှတ်သည်။ Gridzy.js 2 သည် မတူညီသော အကွက်နှစ်ခုကို justified နှင့် waterfall ပံ့ပိုးပေးသည်။ ၎င်းတို့တစ်ခုစီတွင် ၎င်း၏ကိုယ်ပိုင် ထပ်လောင်းရွေးချယ်မှု ဘောင်များပါရှိပြီး၊ ဤဇယားအောက်တွင် သင်တွေ့နိုင်ပါသည်။
filter*မည်သည့်ပုံများကို ပြသသင့်သည်ကို ဆုံးဖြတ်သည်။ မည်သည့် CSS-ရွေးချယ်မှုမဆို ဤနေရာတွင် တန်ဖိုးအဖြစ် အသုံးပြုနိုင်ပါသည်။ များသောအားဖြင့် filterControls မှတဆင့်အလိုအလျောက်သတ်မှတ်သည် (နောက်ရွေးချယ်စရာကိုကြည့်ပါ)။
Filters ကို စစ်ဆေးပါ။
filterControlsရုပ်ပုံများကို စစ်ထုတ်ရန် မည်သည့်ပုံစံဒြပ်စင်များကို သုံးနိုင်သည်ကို ဆုံးဖြတ်ပါ။ HTML ဖောင်ဒြပ်စင်များကို ရွေးချယ်သည့် မည်သည့် CSS ရွေးချယ်မှုမဆို ဤနေရာတွင် တန်ဖိုးအဖြစ် အသုံးပြုနိုင်ပါသည်။
Filters ကို စစ်ဆေးပါ။
autoConsiderScrollBarstruescroll bar များ ပေါ်လာခြင်း သို့မဟုတ် ပျောက်ကွယ်သွားပါက ရရှိနိုင်သော width ကို ခန့်မှန်းရန်။ ဤအလိုအလျောက်စနစ်သည် ပြဿနာများမဖြစ်စေဘဲ ၎င်းကို true ထားရန် အမြဲတမ်းအကြံပြုထားသည်။

Justified အပြင်အဆင် ရွေးစရာများ

မူရင်းတန်ဖိုးဖော်ပြချက်
autoFontSizefalseမူရင်းအကွက်အရွယ်အစားပေါ်မူတည်၍ အကွက်တစ်ခုစီ၏ ဖောင့်အရွယ်အစား ပိုင်ဆိုင်မှုကို အလိုအလျောက် အပ်ဒိတ်လုပ်သည်။ ပုံမှန်အားဖြင့် ဖောင့်အရွယ်အစား ပိုင်ဆိုင်မှုကို အတိအလင်း သတ်မှတ်မထားပေ။
desiredHeight190ဒြပ်စင်အတန်းများ၏ လိုချင်သော အမြင့်ကို သတ်မှတ်သည်။ ရရှိနိုင်သော အကျယ်နှင့် အတန်းရှိ အစိတ်အပိုင်းများပေါ်မူတည်၍ အမှန်တကယ် အမြင့်ကို တွက်ချက်ပါမည်။
hideOnMissingImagetrueတင်၍မရသော ပုံများပါရှိသော အကွက်များကို ဝှက်ထားသည်။
spaceBetween4ပစ်ဇယ်ရှိ ဒြပ်စင်များကြား အကွာအဝေးကို သတ်မှတ်သည်။
lastRowAlign
ဗားရှင်း 2.3.0 ကတည်းက
justifiedနောက်ဆုံးအတန်း၏ အပြုအမူကို သတ်မှတ်သည်။ ခွင့်ပြုထားသောတန်ဖိုးများသည် leftcenterright နှင့် justified ဖြစ်သည်။
singleRowAlign
ဗားရှင်း 2.3.0 ကတည်းက
justifiedအတန်းတစ်ခုတည်းသာရှိလျှင် အပြုအမူကို သတ်မှတ်သည်။ ခွင့်ပြုထားသောတန်ဖိုးများသည် leftcenterright နှင့် justified ဖြစ်သည်။
fillLastRow
ဗားရှင်း 2.1.0 ကတည်းက
trueဗားရှင်း 2.4.0 ကတည်းက ဖယ်ရှားခဲ့သည်။ ( ဗားရှင်း 2.3.0 မှ စ၍ ရပ်ဆိုင်းထားသည်)
နောက်ဆုံးအတန်းကို အမြဲတမ်းပြည့်နေအောင် ပုံတွေကို စီစဉ်ပါ။ အကယ်၍ သင်သည် ပုံများကို ဒိုင်းနမစ်ဖြင့် ပေါင်းထည့်ရန် စီစဉ်ပါက၊ ၎င်းကို ပိတ်ရန် စိတ်ကူးကောင်း ဖြစ်နိုင်သည်။
အတန်းတစ်ခုတည်းအပေါ် သက်ရောက်မှုမရှိပါ ( fillSingleRow ကြည့်ပါ)။
fillSingleRow
ဗားရှင်း 2.1.0 ကတည်းက
trueဗားရှင်း 2.4.0 ကတည်းက ဖယ်ရှားခဲ့သည်။ ( ဗားရှင်း 2.3.0 မှ စ၍ ရပ်ဆိုင်းထားသည်)
အတန်းတစ်ခုသာရှိလျှင် အတန်းသည် အမြဲတမ်းပြည့်နေစေရန် ပုံများကို စီစဉ်ပေးသည်။ အကယ်၍ သင့်တွင် ပြခန်းထဲတွင် ပုံတစ်ပုံ သို့မဟုတ် နှစ်ခုသာ ရှိနေပါက၊ ၎င်းကို ပိတ်ရန် စိတ်ကူးကောင်း ဖြစ်နိုင်သည်။

Waterfall အပြင်အဆင် ရွေးချယ်စရာများ

မူရင်းတန်ဖိုးဖော်ပြချက်
autoFontSizefalseမူရင်းအကွက်အရွယ်အစားပေါ်မူတည်၍ အကွက်တစ်ခုစီ၏ ဖောင့်အရွယ်အစား ပိုင်ဆိုင်မှုကို အလိုအလျောက် အပ်ဒိတ်လုပ်သည်။ ပုံမှန်အားဖြင့် ဖောင့်အရွယ်အစား ပိုင်ဆိုင်မှုကို အတိအလင်း သတ်မှတ်မထားပေ။
desiredWidth250ကော်လံများ၏ လိုချင်သော အကျယ်ကို သတ်မှတ်သည်။ ရရှိနိုင်သော အကျယ်နှင့် ကော်လံအရေအတွက်ပေါ်မူတည်၍ အမှန်တကယ် အကျယ်ကို တွက်ချက်ပါမည်။
hideOnMissingImagetrueတင်၍မရသော ပုံများပါရှိသော အကွက်များကို ဝှက်ထားသည်။
horizontalOrderfalseကော်လံတစ်ခုစီတွင် ဒြပ်စင်များကို ဘယ်ဘက်မှ ညာသို့ တင်းကြပ်စွာ ထားရှိထားကြောင်း၊ ထို့နောက် မည်သည့်ကော်လံတွင် နေရာပိုရသနည်းဆိုသည့် သီးခြားကော်လံတွင် ဘယ်ဘက်ဆုံးကော်လံတွင် ထပ်မံစတင်သည်။ ပုံမှန်အားဖြင့် အစိတ်အပိုင်းများကို အသေးငယ်ဆုံး အမြင့်ဖြင့် ကော်လံတွင် အမြဲထားရှိပါမည်။
spaceBetween4ပစ်ဇယ်ရှိ ဒြပ်စင်များကြား အကွာအဝေးကို သတ်မှတ်သည်။
singleRowAlign
since version 2.7.0
justifiedDefines the behavior when not all columns can be filled due to too few images. Allowed values are left, center, right and justified.

နောက်ထပ်အဆင့်မြင့် ရွေးချယ်စရာများ

နောက်ထပ်အဆင့်မြင့်ရွေးချယ်စရာများအတွက် API ကို စစ်ဆေးပါ။

Semantic HTML

Gridzy ၏ အရိုးရှင်းဆုံး HTML ဖွဲ့စည်းပုံမှာ ဤအရာဖြစ်သည်။

<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>

သို့သော်၊ Gridzy သည် အလွန်ပြောင်းလွယ်ပြင်လွယ်ဖြစ်ပြီး သင်သည် အခြား HTML တည်ဆောက်ပုံအားလုံးကို အသုံးပြုနိုင်သည်။ ထည့်သွင်းစဉ်းစားရန် အချက်အနည်းငယ်သာ ရှိပါသည်။

  • ကွန်တိန်နာဒြပ်စင်၏ ကလေးတိုင်းသည် ဇယားကွက်အတွင်းရှိ အရာတစ်ခုကို ကိုယ်စားပြုသည်။
  • ကွန်တိန်နာဒြပ်စင်နှင့် ၎င်း၏ကလေးများ နှစ်ခုစလုံးသည် ul နှင့် li ကဲ့သို့သော တဂ်အမျိုးအစား ဖြစ်နိုင်သည် (ဘရောက်ဆာမူရင်းများကို ပြန်လည်သတ်မှတ်ရန် စဉ်းစားပါ)။
  • img ဒြပ်စင်သည် တိုက်ရိုက်ကလေးမဟုတ်ပါက၊ ၎င်းသည် class gridzyImage လိုအပ်သည်။

ဒါကြောင့် ဒါက အလုပ်လုပ်တဲ့ HTML ဖွဲ့စည်းပုံတစ်ခုလည်း ဖြစ်ပါတယ်။

<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>

အထူးသဖြင့် စာတန်းများထည့်လိုပါက အဆင့်မြင့် HTML တည်ဆောက်မှု လိုအပ်ပါသည်။ ၎င်းအကြောင်းပိုမိုလေ့လာရန် Captions & Skins တွင်ကြည့်ရှုပါ။

စာတန်းများနှင့် အရေခွံများ

သင့်ပြခန်းသို့ စာတန်းများထည့်လိုပါက၊ အသွင်အပြင်ကို သတ်မှတ်ရန် လိုအပ်သည်။ ထို့ကြောင့် အချို့သော ကြိုတင်သတ်မှတ်ထားသော အရေခွံများကို ရရှိနိုင်သည်။ Skin တစ်ခုစီတွင် CSS ဖိုင်တစ်ခုပါဝင်ပါသည်။ ဤဖိုင်ကို အဓိက Gridzy ဖိုင်များ အပြင် (များသောအားဖြင့် ခေါင်းပိုင်းအပိုင်းတွင်) ထည့်ရန် လိုအပ်သည်-

<link rel="stylesheet" href="gridzy/skins/gridzySkinClassic/style.min.css" />

ထို့အပြင် သင်သည် အဆင့်မြင့် 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>

HTML တည်ဆောက်ပုံအကြောင်း သိချင်ပါက Semantic HTML ကို ကြည့်ပါ။

စာတန်းအတွက် မည်သည့် tag အမျိုးအစားကိုမဆို အသုံးပြုနိုင်ပြီး၊ ၎င်းတွင် class gridzyCaption ပါရှိကြောင်း သေချာပါစေ။ img အစိတ်အပိုင်းသည် class gridzyImage လိုအပ်သည်။

အထက်ဖော်ပြပါ ဥပမာသည် သင့်အား အရေပြား gridzySkinClassic ပြသထားသည်။ အခြားတစ်မျိုးကို အသုံးပြုရန်၊ ဤအရာများထဲမှ တစ်ခုဖြင့် အရေပြားအမည်ကို အစားထိုးလိုက်ပါ-

Skins တွေ ပါဝင်ပါတယ်။

ရနိုင်သောအတန်းများ
gridzySkinBlank
ကိုယ်ပိုင်အသားအရည်ကို ဖန်တီးဖို့အတွက် အစပျိုးကောင်းတစ်ခုပါ။
တိုက်ရိုက်ကြည့်ရှုခြင်း
gridzySkinBlank
gridzySkinClassic
တိုက်ရိုက်ကြည့်ရှုခြင်း
gridzySkinClassic
gridzySkinClassicLight(ဗားရှင်း 2.6.0 မှ စ၍ ရပ်ဆိုင်းထားသည်)
gridzySkinFullOverlay
တိုက်ရိုက်ကြည့်ရှုခြင်း
gridzySkinFullOverlay
gridzySkinFullOverlayLight(ဗားရှင်း 2.6.0 မှ စ၍ ရပ်ဆိုင်းထားသည်)
gridzySkinLift
တိုက်ရိုက်ကြည့်ရှုခြင်း
gridzySkinLift
gridzySkinLiftLight(ဗားရှင်း 2.6.0 မှ စ၍ ရပ်ဆိုင်းထားသည်)
gridzySkinMagnifier
zoom လုပ်ဆောင်ချက် မပါဝင်ပါ။
တိုက်ရိုက်ကြည့်ရှုခြင်း
gridzySkinMagnifier
gridzySkinMagnifierLight(ဗားရှင်း 2.6.0 မှ စ၍ ရပ်ဆိုင်းထားသည်)

အထက်ဖော်ပြပါ skin များအားလုံးသည် CSS ဖိုင်တစ်ခုသာ လိုအပ်သော်လည်း JavaScript ဖိုင်ကိုလည်း လိုအပ်သည့် နောက်ထပ် skins များ ရှိပါသည်။

<link rel="stylesheet" href="gridzy/skins/gridzySkinBlur/style.min.css" />
<script src="gridzy/skins/gridzySkinBlur/script.min.js"></script>
ရနိုင်သောအတန်းများ
gridzySkinBlur
IE တွင်အလုပ်မလုပ်ပါ။
တိုက်ရိုက်ကြည့်ရှုခြင်း
gridzySkinBlur
gridzySkinBlurLight(ဗားရှင်း 2.6.0 မှ စ၍ ရပ်ဆိုင်းထားသည်)
gridzySkinCard
တိုက်ရိုက်ကြည့်ရှုခြင်း
gridzySkinCard
gridzySkinCardLight(ဗားရှင်း 2.6.0 မှ စ၍ ရပ်ဆိုင်းထားသည်)

အရေပြားရွေးချယ်မှုများ

ဗားရှင်း 2.6.0 မှစတင်၍ built-in skins ကို configure လုပ်ရန် Options များရှိပါသည်။ အသားအရောင်ပေါ်မူတည်၍ နောက်ခံအရောင်၊ စာသားအရောင်နှင့် စာသားအရိပ်ကို သင် သတ်မှတ်နိုင်သည်။ ဤနေရာတွင် သင်တွေ့မြင်ရသည့်အတိုင်း CSS စိတ်ကြိုက်ဂုဏ်သတ္တိများကို သင်အသုံးပြုရန် လိုအပ်သည်-

<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>

အရေပြားတစ်ခုစီအတွက် ပံ့ပိုးပေးထားသော ကိန်းရှင်များနှင့် မူရင်းတန်ဖိုးများကို ဤနေရာတွင် စစ်ဆေးကြည့်ပါ-

gridzySkinClassic
ပြောင်းလဲနိုင်သောမူရင်းတန်ဖိုးသတင်းအချက်အလက်
--backgroundrgba(0, 0, 0, .7)မည်သည့် CSS နောက်ခံတန်ဖိုး ကိုမဆို ခွင့်ပြုသည်။
--colorrgb(255, 255, 255)မည်သည့် CSS အရောင်တန်ဖိုး ကိုမဆို ခွင့်ပြုသည်။
--text-shadownoneမည်သည့် CSS စာသားအရိပ်တန်ဖိုး ကိုမဆို ခွင့်ပြုသည်။
gridzySkinFullOverlay
ပြောင်းလဲနိုင်သောမူရင်းတန်ဖိုးသတင်းအချက်အလက်
--backgroundrgba(0, 0, 0, .7)မည်သည့် CSS နောက်ခံတန်ဖိုး ကိုမဆို ခွင့်ပြုသည်။
--colorrgb(255, 255, 255)မည်သည့် CSS အရောင်တန်ဖိုး ကိုမဆို ခွင့်ပြုသည်။
--text-shadownoneမည်သည့် CSS စာသားအရိပ်တန်ဖိုး ကိုမဆို ခွင့်ပြုသည်။
gridzySkinLift
ပြောင်းလဲနိုင်သောမူရင်းတန်ဖိုးသတင်းအချက်အလက်
--backgroundrgba(0, 0, 0, .7)မည်သည့် CSS နောက်ခံတန်ဖိုး ကိုမဆို ခွင့်ပြုသည်။
--colorrgb(255, 255, 255)မည်သည့် CSS အရောင်တန်ဖိုး ကိုမဆို ခွင့်ပြုသည်။
--text-shadow0 0 10px rgb(0, 0, 0), 0 0 20px rgb(0, 0, 0), 0 0 30px rgb(0, 0, 0)မည်သည့် CSS စာသားအရိပ်တန်ဖိုး ကိုမဆို ခွင့်ပြုသည်။
gridzySkinMagnifier
ပြောင်းလဲနိုင်သောမူရင်းတန်ဖိုးသတင်းအချက်အလက်
--backgroundrgba(0, 0, 0, .7)မည်သည့် CSS နောက်ခံတန်ဖိုး ကိုမဆို ခွင့်ပြုသည်။
--colorrgb(255, 255, 255)မည်သည့် CSS အရောင်တန်ဖိုး ကိုမဆို ခွင့်ပြုသည်။

ဤအရေပြားသည် --text-shadow မပံ့ပိုးပါ။

gridzySkinBlur
ပြောင်းလဲနိုင်သောမူရင်းတန်ဖိုးသတင်းအချက်အလက်
--backgroundrgba(0, 0, 0, .7)မည်သည့် CSS နောက်ခံတန်ဖိုး ကိုမဆို ခွင့်ပြုသည်။
--colorrgb(255, 255, 255)မည်သည့် CSS အရောင်တန်ဖိုး ကိုမဆို ခွင့်ပြုသည်။
--text-shadow0 0 10px rgb(0, 0, 0)မည်သည့် CSS စာသားအရိပ်တန်ဖိုး ကိုမဆို ခွင့်ပြုသည်။
gridzySkinCard
ပြောင်းလဲနိုင်သောမူရင်းတန်ဖိုးသတင်းအချက်အလက်
--backgroundrgba(0, 0, 0, 1)မည်သည့် CSS နောက်ခံတန်ဖိုး ကိုမဆို ခွင့်ပြုသည်။
--colorrgb(255, 255, 255)မည်သည့် CSS အရောင်တန်ဖိုး ကိုမဆို ခွင့်ပြုသည်။
--text-shadownoneမည်သည့် CSS စာသားအရိပ်တန်ဖိုး ကိုမဆို ခွင့်ပြုသည်။

ကြိုတင်သတ်မှတ်ထားသော အရေပြားအားလုံးသည် ရိုးရှင်းသော စာသားစာတန်းများကိုသာ ပံ့ပိုးပေးသည်။ သင့်ကိုယ်ပိုင်နှင့် ပိုမိုရှုပ်ထွေးသော အရေခွံများကို သင်ဖန်တီးနိုင်သည်။ Style Gridzy ကို ကြည့်ပါ။

ပုံစံ Gridzy

ကြိုတင်သတ်မှတ်ထားသော အသားအရည်သည် သင့်လိုအပ်ချက်များနှင့် ကိုက်ညီပါက သင့်ကိုယ်ပိုင်ပုံစံကို သင်ပြုလုပ်နိုင်ပါသည်။

အလွယ်ဆုံးနည်းလမ်းမှာ ရှိပြီးသားအသားအရည်ကို ဦးစွာကူးယူပြီး သင့်ကိုယ်ပိုင်လိုအပ်ချက်များနှင့် လိုက်လျောညီထွေဖြစ်အောင် ပြုလုပ်ခြင်းဖြစ်သည်။ ကြိုတင်သတ်မှတ်ထားသော skin gridzySkinBlank သည် အများအားဖြင့် ကောင်းမွန်သောအခြေခံအုတ်မြစ်ဖြစ်သလို CSS ဖိုင်တွင် ကောင်းမွန်သောစာရွက်စာတမ်းများကို ပေးဆောင်သည်-

/** 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;
}

CSS ဖိုင်တွင် gridzySkinBlankgridzyImage နှင့် gridzyCaption အတန်းများကို တွေ့ရပါမည်။ Gridzy ကိုယ်တိုင်က ဒီသင်တန်းတွေ မလိုအပ်ပါဘူး။ ၎င်းတို့ကို ပုံသဏ္ဍာန်ပြုလုပ်ရန်အတွက်သာ အသုံးပြုသောကြောင့် ၎င်းတို့ကို ဖယ်ရှားရန် သို့မဟုတ် အမည်ပြောင်းနိုင်ပါသည်။

ထို့အပြင် CSS အတန်းအစား gridzyItem သင်တွေ့လိမ့်မည်။ Gridzy သည် ဤအတန်းကို ပင်မကွန်တိန်နာဒြပ်စင်၏ တိုက်ရိုက်ကလေးများအားလုံးကို အလိုအလျောက် သတ်မှတ်ပေးသည်။ ထို့ကြောင့်၊ သင်သည် သင်၏ပြခန်းရှိပစ္စည်းများကို ပုံစံဆင်ရန် ဤအတန်းကို အသုံးပြုနိုင်သည်။

စိတ်၏အရေးကြီးသောအရာများ

  1. အကြောင်းအရာသည် အပြည့်အဝတုံ့ပြန်မှုဖြစ်သင့်သည်။ ဒြပ်စင်အရွယ်အစားသည် ကျိန်းသေပြောင်းလဲမည်ကို သုံးသပ်ကြည့်ပါ။ pixel တန်ဖိုးများအစား ရာခိုင်နှုန်းတန်ဖိုးများကို အသုံးပြုပါ။ ပြီးလျှင် ဖောင့ autoFontSize အရွယ်အစားကို item box အရွယ်အစားနှင့် ချိတ်ပေးသော Gridzy layout option ကို ကြည့်ပါ။
  2. အကြောင်းအရာတစ်ခုစီတိုင်းတွင် ကောင်းစွာသတ်မှတ်ထားသော အချိုးအစားရှိသင့်သည်။ ပစ္စည်း၏အချိုးအစားသည် မည်သည့်အခါမျှ ပြောင်းလဲမည်မဟုတ်ဘဲ ဇယားကွက်ကို တွက်ချက်ရန် လိုအပ်ပါသည်။ ထို့ကြောင့် ပစ္စည်းတစ်ခုသည် ကောင်းစွာသတ်မှတ်ထားသော အချိုးအစားကို အလိုအလျောက်မရရှိပါက၊ ၎င်းကို ကိုယ်တိုင်ကြိုတင်သတ်မှတ်ပါ (ဥပမာ css မှတဆင့်)။

အချို့ကိစ္စများတွင်၊ Gridzy စတင်ခြင်းမပြုမီ ပစ္စည်းများ၏အကြောင်းအရာကို ပုံစံတူပြုလုပ်ရန် ပိုမိုလွယ်ကူနိုင်သည်။ ၎င်းအတွက် class gridzy သို့မဟုတ် Gridzy javascript ဖိုင်ကို ယာယီဖယ်ရှားလိုက်ပါ။

ဒါပဲ! ကိုယ့်အသားအရည်ကို တည်ဆောက်ဖို့ ဒါပဲလိုအပ်တယ်။ ကြိုတင်သတ်မှတ်ထားသော skins အများစုသည် ယင်းကို များများမသုံးကြပါ။

ဒါပေမယ့် ကြိုက်ရင် ပိုရှိနိုင်ပါတယ်...

အဆင့်မြင့် စကင်များ

Gridzy သည် gridzyItem တစ်ခုတည်းထက် CSS အတန်းများကို ပိုမိုအသုံးပြုသည်။ ၎င်းတို့အများစုကို အလိုအလျောက်သတ်မှတ်ပေးမည်ဖြစ်ပြီး စတိုင်လ်ပြုလုပ်ရန်အတွက်လည်း သင်အသုံးပြုနိုင်ပါသည်။

Main Container Classes

အတန်းအမည်ဖော်ပြချက်
gridzy
ကိုယ်တိုင်သတ်မှတ်ရန်
Gridzy သည် ဤအတန်းနှင့်အတူ အစိတ်အပိုင်းများကို အလိုအလျောက်ရှာဖွေပြီး ၎င်းတို့ကို အစပြုသည်။
gridzyAnimatedရွေးချယ်စရာ animate true ပါက အလိုအလျောက် သတ်မှတ်ပေးပါမည်။ ဤအတန်းကို ကိုယ်တိုင်သတ်မှတ်ပါက၊ ရွေးချယ်စရာ animate အလိုအလျောက် true သွားလိမ့်မည် (၎င်းကို false ဟု ပြတ်ပြတ်သားသား သတ်မှတ်ထားပါက မှတပါး)။

အကြောင်းအရာ အတန်းများ

အတန်းအမည်ဖော်ပြချက်
gridzyItemပစ္စည်း စတင်ခြင်း လုပ်ငန်းစဉ် စတင်သည်နှင့် တပြိုင်နက် သတ်မှတ်ပေးပါမည်။ ဘယ်တော့မှ ဖယ်ရှားမှာ မဟုတ်ဘူး။
gridzyItemInitializingပစ္စည်း စတင်ခြင်း လုပ်ငန်းစဉ် စတင်သည်နှင့် တပြိုင်နက် သတ်မှတ်ပေးပါမည်။ ပစ္စည်းကို အပြည့်အဝ အစပျိုးပြီးသည်နှင့် gridzyItemReady ဖြင့် အစားထိုးပါမည်။ ပုံများကို အပြည့်တင်ထားသည်မဟုတ်ပါ ( gridzyItemLoading ကြည့်ပါ)၊ သို့သော် အရာသည် မြင်နိုင်စေရန် အဆင်သင့်ဖြစ်နေပြီဖြစ်သည်။
gridzyItemReadyပစ္စည်းကို အပြည့်အဝ အစပျိုးပြီးသည်နှင့် gridzyItemInitializing အစားထိုးပါမည်။ ဘယ်တော့မှ ဖယ်ရှားမှာ မဟုတ်ဘူး။ ပုံများကို အပြည့်တင်ထားသည်မဟုတ်ပါ ( gridzyItemComplete ကြည့်ပါ)၊ သို့သော် အရာသည် မြင်နိုင်စေရန် အဆင်သင့်ဖြစ်နေပြီဖြစ်သည်။
gridzyItemLoadingပစ္စည်း စတင်ခြင်း လုပ်ငန်းစဉ် စတင်သည်နှင့် တပြိုင်နက် သတ်မှတ်ပေးပါမည်။ ပါရှိသော ပုံများ (များသောအားဖြင့် တစ်ခုသာ) ကို အပြည့်အဝ တင်ပြီးသည်နှင့် တပြိုင်နက် gridzyItemComplete ဖြင့် အစားထိုးပါမည်။
gridzyItemCompleteပါရှိသော ပုံများ (ပုံမှန်အားဖြင့် တစ်ခုသာ) အပြည့်တင်ပြီးသည်နှင့် gridzyItemLoading အစားထိုးပါမည်။ ဘယ်တော့မှ ဖယ်ရှားမှာ မဟုတ်ဘူး။
gridzyItemInitialToVisibleပစ္စည်းစတင်ပေါ်လာသည်နှင့်တပြိုင်နက် သတ်မှတ်ပေးပါမည်။ ပစ္စည်းကို လုံးဝမြင်နိုင်သည်နှင့် တပြိုင်နက် ဖယ်ရှားပါမည်။
gridzyItemVisibleပစ္စည်းကို အပြည့်အဝမြင်နိုင်သည်နှင့် တပြိုင်နက် သတ်မှတ်ပါမည်။ ပစ္စည်းပျောက်သည်နှင့်တပြိုင်နက်ဖယ်ရှားလိမ့်မည်။
gridzyItemVisibleToHiddenပစ္စည်းပျောက်သည်နှင့်တပြိုင်နက် သတ်မှတ်ပေးပါမည်။ ပစ္စည်းကို လုံးလုံးဝှက်ထားသည်နှင့် တပြိုင်နက် ဖယ်ရှားပါမည်။
gridzyItemHiddenပစ္စည်းကို လုံးလုံးဝှက်ထားသည်နှင့် တပြိုင်နက် သတ်မှတ်ပါမည်။ ပစ္စည်းပေါ်လာသည်နှင့်တပြိုင်နက် ဖယ်ရှားပါမည်။
gridzyItemHiddenToVisibleပစ္စည်းစတင်ပေါ်လာသည်နှင့်တပြိုင်နက် သတ်မှတ်ပေးမည် (ပထမအကြိမ်ပေါ်လာခြင်းမှလွဲ၍ - class gridzyItemInitialToVisible ကိုကြည့်ပါ)။ ပစ္စည်းကို လုံးဝမြင်နိုင်သည်နှင့် တပြိုင်နက် ဖယ်ရှားပါမည်။
gridzyItemVisibleToVisibleဇယားကွက်တွင် တစ်ခုခုပြောင်းလဲသွားသည်နှင့် တပြိုင်နက် သတ်မှတ်ပေးမည်ဖြစ်သော်လည်း ၎င်းကိုယ်တိုင်က မြင်နိုင်နေမည်ဖြစ်သည်။ ပြောင်းလဲခြင်း ကာတွန်းပုံ ပြီးသည်နှင့် တပြိုင်နက် ဖယ်ရှားပါမည်။

ပုံမှန်အားဖြင့် လုပ်ငန်းစဉ်ညွှန်ပြချက်နှင့် ပေါ်လာခြင်းနှင့် ပျောက်နေသောပုံများအတွက် အန်နီမေးရှင်းများကို Gridzy ပင်မ CSS ဖိုင်မှ ကြိုတင်သတ်မှတ်ထားသည်။

အထက်ဖော်ပြပါ CSS အတန်းများသည် သင့်ကိုယ်ပိုင် လုပ်ငန်းစဉ်ညွှန်ပြချက်များနှင့် ကာတွန်းများကို ပုံစံထုတ်နိုင်သည်။ သင် override လုပ်ရမယ်ဆိုတာ နားလည်ဖို့ Gridzy ပင်မ CSS ဖိုင်ကို ကြည့်ပါ။ မကြောက်ပါနဲ့၊ အရာအားလုံးကို အဲဒီမှာ မှတ်တမ်းတင်ထားတယ်။

Loading ကို အကောင်းဆုံးဖြစ်အောင်လုပ်ပါ။

အကယ်၍ သင်သည် ပုံများစွာကို အသုံးပြုပါက၊ Gridzy သည် ဇယားကွက်ကို ပိုမိုမြန်ဆန်စွာ တည်ဆောက်ရာတွင် ကူညီရန် အကြံကောင်းဖြစ်နိုင်သည်။

ခုန်နေသည့်ပုံများကို တားဆီးပါ။

Gridzy သည် ဇယားကွက်ကို တွက်ချက်ရန် ပုံအားလုံး၏ ရှုထောင့်အချိုးကို လုံးဝလိုအပ်သည်။ အချို့သောပုံများသည် အဆင်သင့်ဖြစ်ပြီး အခြားအရာများမဟုတ်ပါက ဤအချက်များသည် ဒြပ်စင်များ ခုန်တက်စေပါသည်။ ပုံတွေများလေလေ ဒီအကျိုးသက်ရောက်မှုက ပိုစိတ်အနှောက်အယှက်ဖြစ်နိုင်ပါတယ်။

ဤအပြုအမူကို ကာကွယ်ရန်၊ img ဒြပ်စင်အားလုံးအတွက် width နှင့် height attribute များကို သတ်မှတ်လိုက်ပါ။ ပုံတစ်ပုံချင်းစီအတွက် မှန်ကန်သောတန်ဖိုးများကို သတ်မှတ်ရန် အရေးကြီးသည်၊ မဟုတ်ပါက ပုံများသည် ပုံပျက်သွားမည်ဖြစ်သည်။ မှန်ကန်သောတန်ဖိုးများသည် သက်ဆိုင်ရာပုံ၏ မူရင်းအကျယ်နှင့် အမြင့်ဖြစ်သည်-

<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>

ထို့နောက် Gridzy သည် ပုံများ၏ အမှန်တကယ် အရွယ်အစားများကို သိရှိရန်မလိုအပ်ဘဲ ဇယားကွက်ကို ချက်ချင်းတွက်ချက်နိုင်သည်။

Lazy Loading

မြင်နိုင်သော မြင်ကွင်းပို့တ်တွင်ရှိသော ပုံများကိုသာ တင်ရန်၊ ဤအဆင့်များကို လိုက်နာပါ-

  1. အထက်တွင်ဖော်ပြထားသည့်အတိုင်း width နှင့် height ထည့်သွင်းပါ (မှန်ကန်သောတန်ဖိုးများကို အသုံးပြုရန် သေချာပါစေ)
  2. အောက်တွင်ပြထားသည့်အတိုင်း src attribute အားလုံးကို data-gridzylazysrc ဖြင့် အစားထိုးပါ (သင့်တွင် srcset ရည်ညွှန်းချက်များလည်းရှိပါက၊ ၎င်းတို့ကို 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>

ဤအဆင့်များပြီးပါက ရုပ်ပုံများသည် ၎င်းတို့အနီး သို့မဟုတ် မြင်ကွင်းပို့တ်အတွင်း၌ ရှိနေသည်နှင့်တပြိုင်နက် ပေါ်လာမည်ဖြစ်သည်။

လုပ်ငန်းစဉ်အညွှန်း

လုပ်ငန်းစဉ်ညွှန်ပြချက်သည် ပုံကိုဖွင့်နေစဉ်တွင် ပေါ်လာသည့် ကာတွန်းအိုင်ကွန်ငယ်ဖြစ်သည်။ စာတန်းများနှင့် အရေခွံများကို အသုံးပြုပါက၊ လုပ်ငန်းစဉ်အညွှန်းကို အလိုအလျောက်ပြသပါမည်။ မဟုတ်ပါက သင်သည် ပြုပြင်ပြောင်းလဲမှုအချို့ လိုအပ်သည်-

  1. img ဒြပ်စင်တစ်ခုစီကို div ဒြပ်စင်တစ်ခုထဲသို့ ထည့်ပါ။
    (သို့မဟုတ်အခြားဒြပ်စင်တစ်ခုခုသို့ - နောက်ထပ်လေ့လာရန် semantic HTML ကို ကြည့်ပါ)
  2. class gridzyImage 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>

ထို့နောက် ပုံများကို တင်ရန် အချိန်ယူပါက လုပ်ငန်းစဉ်အညွှန်းများကို သင်တွေ့ရပါမည်။

စစ်ထုတ်မှုများ

Gridzy ရှိ စစ်ထုတ်မှုများသည် အလွန်ရိုးရှင်းသော်လည်း အစွမ်းထက်သည်။ မည်သည့် filter အမျိုးအစားကို လိုအပ်သည်ဖြစ်စေ ၎င်းကို အကောင်အထည်ဖော်ရန် အလားအလာ အလွန်များပါသည်။ သင်လိုအပ်သည်မှာ၊ CSS အနည်းငယ်နှင့် HTML ဖောင်ဒြပ်စင်အနည်းငယ်ဖြစ်သည်။

ဤတွင် functional ဥပမာတစ်ခုဖြစ်သည်။

<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>

တစ်ဆင့်ပြီးတစ်ဆင့် တည်ဆောက်လိုက်ရအောင်

1. ပထမဦးစွာ ကျွန်ုပ်တို့သည် Gridzy ၏ ပုံမှန် HTML ဖွဲ့စည်းပုံကို လိုအပ်ပြီး ပြခန်းအရာအားလုံးအတွက် အတန်းအမည်များ သတ်မှတ်ပေးခြင်းဖြင့် ၎င်းတို့ကို စစ်ထုတ်နိုင်မည်ဖြစ်သည်။

<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>

ဤဥပမာတွင် ကျွန်ုပ်တို့သည် အစိတ်အပိုင်းတစ်ခုစီအတွက် class တစ်ခုသာ အသုံးပြုပါသည်။ သို့သော် ၎င်းဒြပ်စင်ကို စစ်ထုတ်မှုများစွာဖြင့် ရှာဖွေနိုင်ပါက ဒြပ်စင်တစ်ခုတည်းအတွက် အတန်းများစွာကို သင်သတ်မှတ်နိုင်သည်။

2. ထို့နောက် filter များကိုပြောင်းလဲနိုင်သောခလုတ်အချို့ကိုကျွန်ုပ်တို့ထည့်ပါ။

<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>

ခလုတ်များအစား၊ အမှန်ခြစ်ဘောက်စ်များ၊ ရေဒီယိုခလုတ်များ၊ ရွေးချယ်ထားသည့် အကွက်များနှင့် အခြားပုံစံဒြပ်စင်များကိုလည်း အသုံးပြုနိုင်သည်။

သင်တွေ့မြင်ရသည့်အတိုင်း ခလုတ်များ၏ တန်ဖိုးများသည် ပုံမှန် CSS ရွေးပေးသူများဖြစ်သည်။ ကျွန်ုပ်တို့ပြီးဆုံးသည်နှင့်တပြိုင်နက်၊ ထိုကဲ့သို့သောခလုတ်ကိုနှိပ်လိုက်ခြင်းဖြင့် ထို CSS ရွေးချယ်သည့်ကိရိယာနှင့် ကိုက်ညီသောရုပ်ပုံများကို ပြသမည်ဖြစ်သည်။ နည်းပညာအရ ၎င်းသည် filter option ကို ဤတန်ဖိုးသို့ ရိုးရိုးရှင်းရှင်း သတ်မှတ်ပေးသည်။

သင်သည် ပိုမိုရှုပ်ထွေးသော ရွေးချယ်မှုများကိုလည်း အသုံးပြုနိုင်သည်။ ဥပမာ :not(.animals) .animals.people နှင့် .animals, .people .

3. နောက်ဆုံးအနေဖြင့်၊ ကျွန်ုပ်တို့သည် ခလုတ်များကို div ကွန်တိန်နာတစ်ခုတွင် ထုပ်ပိုးပြီး filterControls ရွေးချယ်မှုကို သတ်မှတ်ခြင်းဖြင့် ၎င်းတို့ကို Gridzy ပြခန်းတွင် ချည်နှောင်ထားသည်။

<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>

သင်တွေ့မြင်ရသည့်အတိုင်း၊ ကျွန်ုပ်တို့သည် filterControls ရွေးချယ်မှုအတွက် CSS ရွေးချယ်မှုတစ်ခုကိုလည်း အသုံးပြုပါသည်။ id attribute ပါသော div container သည် ထို CSS ရွေးချယ်မှုမှတစ်ဆင့် ခလုတ်များကို ပိုမိုလွယ်ကူစွာ ရွေးချယ်နိုင်စေရန်သာ လုပ်ဆောင်ပါသည်။

ဒါပဲ!

JavaScript ဖြေရှင်းချက်ကို နှစ်သက်ပါက API ကို စစ်ဆေးပါ။

API

Gridzy တွင် ၎င်း၏ကိုယ်ပိုင် API ရှိသော်လည်း၊ အများစုမှာ DOM ကို ကြိုးကိုင်ခြင်းဖြင့် ၎င်းမပါဘဲ လုပ်ဆောင်နိုင်သည်။ Gridzy သည် ၎င်းကို သတိပြုမိပြီး ဇယားကွက်ကို ချိန်ညှိမည်ဖြစ်သည်။ ဒါပေမယ့် အလွန်အစွမ်းထက်တဲ့ API လည်းရှိပါတယ်...

DOM ကို ကြိုးကိုင်ခြင်း။

Document Object Model (DOM) manipulations အားလုံးအတွက် container element ကို အရင်ဆုံး လိုအပ်ပါတယ်-

// get the container element
var gridzyElement = document.querySelector('.gridzy');

ပုံများထည့်ပါ။

ကွန်တိန်နာဒြပ်စင်သို့မထည့်မီ ကလေးဒြပ်စင်အသစ်ကို အပြည့်အဝတည်ဆောက်ပြီး ဖြည့်စွက်ရန် အရေးကြီးသည်။ မဟုတ်ပါက Gridzy သည် မှန်ကန်သောအတိုင်းအတာများကို ရှာဖွေနိုင်မည်မဟုတ်ပါ။

// 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);

ပုံများကို ဖယ်ရှားပါ။

// remove the first image
gridzyElement.removeChild(gridzyElement.firstElementChild);

ရွေးချယ်စရာများကို ပြောင်းလဲပါ။

// 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');

DOM ကို စီမံခန့်ခွဲခြင်းအကြောင်း MDN ဝဘ်ဒေါ့စ် တွင် သင်တွေ့နိုင်ပါသည်။ ရရှိနိုင်သော DOM ကို နိဒါန်း တစ်ခုလည်း ရှိပါသည်။

ကိုယ်ပိုင် API

API ကိုအသုံးပြုရန်၊ Gridzy ကွန်တိန်နာဒြပ်စင်နှင့် ချိတ်ဆက်ထားသည့် Gridzy ဥပမာကို လိုအပ်သည်-

// get the Gridzy instance
var gridzyInstance = document.querySelector('.gridzy').gridzy;

ရွေးချယ်မှုရယူပါ။

// get the value of a single option
var currentLayout = gridzyInstance.getOption('layout');

ရွေးချယ်စရာများအားလုံးကို ရယူပါ။

// get all option values as an object
var currentOptions = gridzyInstance.getOptions();

ရွေးချယ်စရာများ သတ်မှတ်ပါ။

// set specific option values
gridzyInstance.setOptions({
  spaceBetween: 10,
  layout: 'waterfall'
});

// or reset options to their default values
gridzyInstance.setOptions({
  spaceBetween: null,
  layout: null
});

Filter ကိုသုံးပါ။

စစ်ထုတ်ခြင်းကိုအသုံးပြုခြင်းသည် တရားဝင် CSS ရွေးပေးသူတိုင်း ဖြစ်နိုင်သည့် ရွေးချယ်မှု filter သတ်မှတ်ခြင်းသာဖြစ်သည်-

// 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'
});

ပြန်ခေါ်ခြင်းလုပ်ဆောင်ချက်များကို ထည့်ပါ။

ဗားရှင်း 2.4.0 မှစတင်၍ ကန့်ကွက်ထားသည်
ခေတ်မီပြီး ပိုလိုက်လျောညီထွေရှိသော Events များကို အသုံးပြုပါ။ အသေးစိတ်အတွက် နောက်အပိုင်းကို ကြည့်ပါ။

Gridzy.js 2 သည် ပြန်ခေါ်သည့်လုပ်ဆောင်ချက်များအတွက် ရွေးချယ်စရာအချို့ကို ပံ့ပိုးပေးသည်။ ၎င်းတို့ကို မူပိုင် API မှတစ်ဆင့်သာ သတ်မှတ်နိုင်သော်လည်း အခြားရွေးချယ်စရာများကဲ့သို့ပင်။

// 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.
  }
});
ဖော်ပြချက်
onBeforeOptionsChangedရွေးချယ်စရာများကို သတ်မှတ်ခြင်းမပြုမီ တိုက်ရိုက်ခေါ်ဆိုသော ပြန်ခေါ်သည့်လုပ်ဆောင်ချက်။
onOptionsChangedရွေးချယ်မှုများ ဆက်တင်ပြီးနောက် တိုက်ရိုက်ခေါ်ဆိုသော ပြန်ခေါ်သည့် လုပ်ဆောင်ချက်။
onBeforeRenderမဖော်ပြမီ တိုက်ရိုက်ခေါ်ဆိုသော ဖုန်းခေါ်ဆိုမှု လုပ်ဆောင်ချက်။
onRenderတင်ဆက်ပြီးနောက် တိုက်ရိုက်ခေါ်ဆိုသော ပြန်ခေါ်သည့် လုပ်ဆောင်ချက်။

ပွဲများကိုသုံးပါ။

ဗားရှင်း 2.4.0 ကတည်းက

ပုံမှန် JavaScript အစီအစဉ်များကဲ့သို့ Gridzy ဖြစ်ရပ်များကို သင်အသုံးပြုနိုင်သည်-

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.
});

အချို့သောဖြစ်ရပ်များကို Gridzy ကွန်တိန်နာဒြပ်စင်ပေါ်တွင် ပစ်ခတ်ပြီး ကွန်တိန်နာဒြပ်စင်အတွင်းရှိ အရာတစ်ခုချင်းစီတွင် အခြားဖြစ်ရပ်များကို ပစ်ခတ်သည်။

Gridzy ကွန်တိန်နာဒြပ်စင်ပေါ်တွင် ဖြစ်ပျက်ခဲ့သော ဖြစ်ရပ်များ-

ဖော်ပြချက်
gridzyBeforeInitပြခန်းစတင်ခြင်းမပြုမီ မီးလောင်ကျွမ်းမှုများ။
gridzyInitပြခန်းစတင်ပြီးနောက် မီးလောင်ကျွမ်းမှု။
gridzyBeforeOptionsChangedရွေးချယ်စရာများ မသတ်မှတ်မီ မီးများပွင့်ခြင်း။
gridzyOptionsChangedရွေးချယ်စရာများကို ဆက်တင်ပြီးနောက် မီးလောင်သည်။
gridzyBeforeRenderတင်ဆက်ခြင်းမပြုမီ မီးလောင်ခြင်း။
gridzyRenderတင်ဆက်ပြီးနောက် မီးလောင်သည်။
အကယ်၍ သင်သည် ဤနေရာတွင် အဖြစ်အပျက်များကို လွတ်သွားပါက၊ ကျေးဇူးပြု၍ အကူအညီတောင်းခံမှု တစ်ခု ပေးပို့ပါ။

event.target Gridzy container element ကို ပံ့ပိုးပေးသည်။
event.detail.instance Gridzy instance ကို ပံ့ပိုးပေးသည်။

ပစ္စည်းဒြပ်စင်များပေါ်တွင် ဖြစ်ရပ်များ-

ဖော်ပြချက်
gridzyItemBeforeInitပစ္စည်းအစပျိုးခြင်းမပြုမီ မီးလောင်မှုများ။
gridzyItemInitပစ္စည်းအစပျိုးပြီးနောက် မီးလောင်သည်။
gridzyItemLoadingပစ္စည်းစတင်ဖွင့်သောအခါတွင် မီးပျက်သည်။
gridzyItemReadyဇယားကွက်တွက်ချက်မှုအတွက် အဆင်သင့်ဖြစ်သောအခါတွင် မီးလောင်ပါမည်။ ထို့ကြောင့် ရှုထောင့်အချိုးကို သိသော်လည်း ပုံသည် တင်နေသေးသည်။
gridzyItemCompleteပစ္စည်းပုံအား အပြည့်ထည့်ထားသောအခါတွင် မီးပျက်သွားပါသည်။
အကယ်၍ သင်သည် ဤနေရာတွင် အဖြစ်အပျက်များကို လွတ်သွားပါက၊ ကျေးဇူးပြု၍ အကူအညီတောင်းခံမှု တစ်ခု ပေးပို့ပါ။

event.target သက်ဆိုင်ရာ item element ကို ပံ့ပိုးပေးသည်။
event.detail.instance Gridzy instance ကို ပံ့ပိုးပေးသည်။

API - ကမ္ဘာလုံးဆိုင်ရာ

Gridzy ဖြစ်ရပ်များနှင့် ကင်းလွတ်သော လုပ်ဆောင်ချက်အချို့ရှိသည်။ ဒါကြောင့် အရင်က ဥပမာတစ်ခုယူဖို့ မလိုအပ်ပါဘူး။

မူရင်းရွေးချယ်ခွင့်ကို ရယူပါ။

// get the default value of a single option
var defaultLayout = Gridzy.getDefaultOption('layout');

ပုံသေရွေးချယ်စရာများအားလုံးကို ရယူပါ။

// 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');

ပုံသေရွေးချယ်မှုများကို သတ်မှတ်ပါ။

၎င်းသည် စတင်လုပ်ဆောင်ထားပြီးဖြစ်သော Gridzy ဖြစ်ရပ်များအားလုံးကို မသတ်မှတ်ထားသော်လည်း ဖြစ်ရပ်အသစ်များအတွက် အခြေခံကို သတ်မှတ်ပေးပါသည်။ သို့သော်လည်း၊ ရှိပြီးသား instance တစ်ခု၏ option တစ်ခုကို value null မှတစ်ဆင့် ပြန်လည်သတ်မှတ်မည်ဆိုပါက၊ ၎င်းသည် default value အသစ်ကို အသုံးပြုမည်ဖြစ်သည်။

// set default option values
Gridzy.setDefaultOptions({
  spaceBetween: 10,
  layout: 'waterfall'
});

DOM အဆင်သင့်မဖြစ်မီတွင် ၎င်းကိုခေါ်ဆိုပါက တစ်ကမ္ဘာလုံးအတိုင်းအတာဖြင့် ရွေးချယ်မှုများကို သတ်မှတ်ရန် ၎င်းကို သင်အသုံးပြုနိုင်ပါသည်။ ထို့ကြောင့် သင်သည် ရွေးချယ်မှုများကို အရည်အချင်းများအဖြစ် သတ်မှတ်ရန် မလိုအပ်တော့ပါ။

အလိုအလျောက်စနစ်များ

Gridzy.js 2 ၏ အလိုအလျောက်စနစ်အားလုံးသည် အသက်ဝင်နေသရွေ့၊ အောက်ပါနည်းလမ်းများအတွက် မလိုအပ်ပါ။ သို့သော် Gridzy ကို သမားရိုးကျနည်းဖြင့် အသုံးပြုရန် အလိုအလျောက်စနစ်များကို ပိတ်နိုင်သည်-

// 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
});

ဤရွေးချယ်စရာများထဲမှ အချို့ကို data-gridzy- attributes များမှတဆင့် သို့မဟုတ် setOptions() မှတဆင့် သတ်မှတ်၍မရပါ၊ ယုတ္တိရှိသောအကြောင်းပြချက်များကြောင့်-

မူရင်းတန်ဖိုးဖော်ပြချက်
autoInitOnDomReadytrueစာမျက်နှာဖွင့်ခြင်းတွင် အတန်း gridzy ဖြင့် အစိတ်အပိုင်းများကို ရှာဖွေတွေ့ရှိပြီး ၎င်းတို့ကို အစပြုပါသည်။

Gridzy.setDefaultOptions() မှတဆင့် သတ်မှတ်နိုင်သည်
autoInitOnDomMutation
MutationObserver
trueDOM တွင်ပေါ်လာပြီး ၎င်းတို့ကို စတင်လုပ်ဆောင်သည်နှင့်တစ်ပြိုင်နက် class gridzy ဖြင့် ဒြပ်စင်အသစ်များကို ရှာဖွေတွေ့ရှိသည်။ (ဥပမာ စာမျက်နှာအကူးအပြောင်းများကို အသုံးပြုခြင်း)

Gridzy.setDefaultOptions() မှတဆင့် သတ်မှတ်နိုင်သည်
autoSyncChildListMutation
MutationObserver
trueကလေးဒြပ်စင်များ (ပုံများ) ကို ပေါင်းထည့်ခြင်း သို့မဟုတ် ဖယ်ရှားခြင်း ရှိ၊မရှိ စစ်ဆေးပြီး ဂရစ်ကို အလိုအလျောက် အပ်ဒိတ်လုပ်ခြင်း

data-grizy-new Gridzy()setOptions()Gridzy.setDefaultOptions()
useOptionAttributestruedata-gridzy- attribute များကို ယေဘူယျအားဖြင့် အသုံးပြုသည် ရှိ၊ မရှိ သတ်မှတ်သည်။ ၎င်းသည် false ရွေးချယ်မှုများဖြစ်ပါက တစ်ဦးတည်းပိုင် API မှတစ်ဆင့်သာ သတ်မှတ်နိုင်သည်။

new Gridzy()setOptions()Gridzy.setDefaultOptions() မှတဆင့် သတ်မှတ်နိုင်သည်
autoSyncAttributesMutation
MutationObserver
truedata-gridzy- attribute များ၏ပြောင်းလဲမှုများကိုသိရှိနိုင်ပြီး grid ကိုအလိုအလျောက် update လုပ်သည်။ gridzyAnimated class ကို ပေါင်းထည့်ခြင်း သို့မဟုတ် ဖယ်ရှားခြင်း ရှိ၊ မရှိ နှင့် style attribute အပြောင်းအလဲများ ဖြစ်ပေါ်ခြင်း ရှိမရှိကိုလည်း သိရှိနိုင်သည်။ useOptionAttributes သည် false ဖြစ်ပါက၊ style attribute အပြောင်းအလဲများကိုသာ သိရှိနိုင်သည်။

data-grizy-new Gridzy()setOptions()Gridzy.setDefaultOptions() မှတဆင့် သတ်မှတ်နိုင်သည်
autoSyncChildClassMutation
MutationObserver
trueကလေးဒြပ်စင်များ (ပုံများ) အားလုံး၏ class ရည်ညွှန်းချက်များ၏ အပြောင်းအလဲများကို ရှာဖွေပါ။ စီစစ်မှုများနှင့် ပတ်သက်.

data-grizy-new Gridzy()setOptions()Gridzy.setDefaultOptions()
autoSyncImageMutation
MutationObserver

ဗားရှင်း 2.5.0 ကတည်းက
trueပုံအားလုံး၏ src ရည်ညွှန်းချက်များ၏ အပြောင်းအလဲများကို ရှာဖွေပါ။ React သို့မဟုတ် အလားတူ စာကြည့်တိုက်များနှင့် အသုံးပြုသည့်အခါ သက်ဆိုင်ရာ။

data-grizy-new Gridzy()setOptions()Gridzy.setDefaultOptions()
autoRenderOnResize
ResizeObserver

ဗားရှင်း 2.6.0 ကတည်းက
trueဒြပ်စင်အကျယ်၏ပြောင်းလဲမှုများကို သိရှိနိုင်သည်။ တုံ့ပြန်မှုဒီဇိုင်းနှင့် ပတ်သက်. (ဗားရှင်း 2.6.0 မတိုင်မီတွင် ဝင်းဒိုးအရွယ်အစား ပြောင်းလဲသည့် အစီအစဉ်နားဆင်သူကို အသုံးပြုခဲ့သည်)

data-grizy-new Gridzy()setOptions()Gridzy.setDefaultOptions()

ကိုယ်တိုင်စတင်ပါ။

// initialize a new Gridzy instance
var gridzyInstance = new Gridzy(document.querySelector('.gridzy'), {
  spaceBetween: 10,
  layout: 'waterfall'
});

Instance ကိုဖျက်ပါ။

အကြမ်းဖျင်းပြောသည်မှာ Gridzy ကို အစပြုခြင်း၏ ဆန့်ကျင်ဘက်ဖြစ်သည်။

gridzyInstance.destroy();
gridzyInstance = null;

ကလေးစာရင်းကို ကိုယ်တိုင်စင့်ခ်လုပ်ပါ။

// after child elements (images) are added to or removed from the DOM.
gridzyInstance.syncChildList();

Single Child Element ကို ကိုယ်တိုင် စင့်ခ်လုပ်ပါ။

အလွန်ရှားပါးသော ကိစ္စများမှလွဲ၍ အများအားဖြင့် မလိုအပ်ပါ။

// after child elements (images) are added to the DOM and only one of them should be synced to Gridzy.
gridzyInstance.syncChild(childElement);

အရည်အချင်းများကို ကိုယ်တိုင်စင့်ခ်လုပ်ပါ။

ဤအတွက် useOptionAttributes option သည် true ဖြစ်ရမည်ကို သတိပြုပါ။

// after data-gridzy- attributes have changed
gridzyInstance.syncAttributes();

အတင်း ပုံဖော်ခြင်း။

အလိုအလျောက်စနစ်အားလုံးကို ပိတ်ထားသော်လည်း များသောအားဖြင့် မလိုအပ်ပါ။

gridzyInstance.render();