Source

ፈረሰ

ኣብ መላእ ፕሮጀክትካ ርኡይነት ትሕዝቶ ብውሑዳት ክፍልታትን ናይ ጃቫስክሪፕት ፕላጊናትናን ምቕያር።

ከመይ ይሰርሕ

እቲ collapse JavaScript plugin ትሕዝቶ ንምርኣይን ንምሕባእን ይጥቀመሉ። መጠወቒታት ወይ መልህቕ ከም መበገሲታት ዝጥቀሙ ኮይኖም ናብ ፍሉያት ባእታታት ትቕይሮም ዝምደብ እዩ። ንሓደ ባእታ ምፍራስ ነቲ heightካብቲ ሕጂ ዘለዎ ዋጋ ናብ 0. paddingCSS ንኣኒሜሽን ብኸመይ ከም ዝሕዞ ኣብ ግምት ብምእታው ፡ ኣብ ሓደ .collapseባእታ ክትጥቀመሉ ኣይትኽእልን ኢኻ ። ኣብ ክንድኡስ፡ ነቲ ክፍሊ ከም ናጻ መጠቕለሊ ባእታ ተጠቐመሉ።

ናይዚ ኣካል ተንቀሳቓሲ ውጽኢት ኣብቲ ናይ prefers-reduced-motionሚድያ ሕቶ ዝምርኮስ እዩ። ኣብቲ ናይ ተበጻሕነት ሰነድና ኣብቲ ዝተቐነሰ ምንቅስቓስ ዝብል ክፍሊ ርአ ።

ኣብነት

ካልእ ባእታ ብመንገዲ ለውጢ ክፍሊ ንምርኣይን ንምሕባእን ኣብ ታሕቲ ዘለዉ መጠወቒታት ጠውቑ፤

  • .collapseትሕዝቶ ይሓብእ እዩ።
  • .collapsingኣብ እዋን ምስግጋር ይትግበር
  • .collapse.showትሕዝቶ የርኢ

ምስቲ ባህሪ ዘለዎ መላግቦ ክትጥቀም ትኽእል ኢኻ href፣ ወይ ድማ ምስቲ ባህሪ ዘለዎ መጠወቒ data-target። ኣብ ክልቲኡ ኩነታት፡ እቲ data-toggle="collapse"ይድለ።

Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.
<p>
  <a class="btn btn-primary" data-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false" aria-controls="collapseExample">
    Link with href
  </a>
  <button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
    Button with data-target
  </button>
</p>
<div class="collapse" id="collapseExample">
  <div class="card card-body">
    Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.
  </div>
</div>

ብዙሕ ዕላማታት

A <button>ወይ ኣብ ናቱ ወይ ባህርያቱ <a>ብJQuery መምረጺ ብምውካስ ብዙሓት ባእታታት ከርኢን ክሓብኦምን ይኽእል ። ብዙሕ ወይ ንሓደ ባእታ ከርእይዎን ክሓብእዎን ይኽእሉ ነፍሲ ወከፎም ብናቶም ወይ ባህርይ እንተወከስዎ።hrefdata-target<button><a>hrefdata-target

Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.
<p>
  <a class="btn btn-primary" data-toggle="collapse" href="#multiCollapseExample1" role="button" aria-expanded="false" aria-controls="multiCollapseExample1">Toggle first element</a>
  <button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#multiCollapseExample2" aria-expanded="false" aria-controls="multiCollapseExample2">Toggle second element</button>
  <button class="btn btn-primary" type="button" data-toggle="collapse" data-target=".multi-collapse" aria-expanded="false" aria-controls="multiCollapseExample1 multiCollapseExample2">Toggle both elements</button>
</p>
<div class="row">
  <div class="col">
    <div class="collapse multi-collapse" id="multiCollapseExample1">
      <div class="card card-body">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.
      </div>
    </div>
  </div>
  <div class="col">
    <div class="collapse multi-collapse" id="multiCollapseExample2">
      <div class="card card-body">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.
      </div>
    </div>
  </div>
</div>

ኣኮርድዮን ኣብነት

ነቲ ናይ ካርድ ክፍሊ ብምጥቃም፡ ነቲ ነባሪ ናይ ምዕጻፍ ባህሪ ከተናውሖ ትኽእል ኢኻ ኣኮርድዮን ክትፈጥር። ቅዲ ኣኮርድዮን ብግቡእ ንምዕዋት .accordion፡ ከም መጠቕለሊ ምጥቃምካ ኣረጋግጽ።

Anim pariatur cliche reprehenderit, enim eiusmod ልዑል ህይወት accusamus ቴሪ ሪቻርድሰን ኣድ ስኩዊድ. 3 ዝብኢ ወርሒ officia aute, ዘይ cupidat ስኬትቦርድ dolor ብርንች. ናይ መግቢ ናይ ጽዕነት መኪና quinoa nesciunt laborum eiusmod. ብርንች 3 ዝብኢ ወርሒ tempor, sunt aliqua ዑፍ ኣብ ልዕሊኡ ኣቐሚጡ ስኩዊድ ንጽል-መበቆል ቡን nulla assumenda shoreditch et. ኒሂል ኣኒም ኬፊየህ ሄልቨቲካ፡ ኢደ ጥበብ ቢራ ላቦረ ዌስ ኣንደርሰን ክሬድ ነስቺውንት ሳፒየንተ ኢኣ ፕሮይደንት። ኣድ ቪጋን ብዘይካ ስጋ ምክትል ሎሞ። ሌጊንስ occaecat ኢደ ጥበብ ቢራ ሕርሻ-ናብ-ጠረጴዛ, ጥረ ዲኒም ስነ-ጽባቐ synth nesciunt ምናልባት ብዛዕባኦም accusamus labore ዘላቒ VHS ዘይሰማዕካዮም።

Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.

Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
<div class="accordion" id="accordionExample">
  <div class="card">
    <div class="card-header" id="headingOne">
      <h2 class="mb-0">
        <button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
          Collapsible Group Item #1
        </button>
      </h2>
    </div>

    <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordionExample">
      <div class="card-body">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
      </div>
    </div>
  </div>
  <div class="card">
    <div class="card-header" id="headingTwo">
      <h2 class="mb-0">
        <button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
          Collapsible Group Item #2
        </button>
      </h2>
    </div>
    <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordionExample">
      <div class="card-body">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
      </div>
    </div>
  </div>
  <div class="card">
    <div class="card-header" id="headingThree">
      <h2 class="mb-0">
        <button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
          Collapsible Group Item #3
        </button>
      </h2>
    </div>
    <div id="collapseThree" class="collapse" aria-labelledby="headingThree" data-parent="#accordionExample">
      <div class="card-body">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
      </div>
    </div>
  </div>
</div>

ተበጻሕነት

aria-expandedኣብቲ ናይ ምቁጽጻር ባእታ ምውሳኽካ ኣረጋግጽ ። እዚ ባህሪ እዚ ህሉው ኩነታት ናይቲ ምስቲ ቁጽጽር ዝተኣሳሰር ዝዕጸፍ ባእታ ብግልጺ ናብ ስክሪን ኣንበብቲን ተመሳሳሊ ሓገዝቲ ቴክኖሎጂታትን የመሓላልፍ። እቲ ዝዕጾ ባእታ ብነባሪ እንተተዓጽዩ፡ እቲ ኣብቲ ናይ ምቁጽጻር ባእታ ዘሎ ባህሪ ዋጋ ክህልዎ ይግባእ aria-expanded="false"። ነቲ ዝዕጾ ባእታ ብነባሪ showንክፍሊ ተጠቒምካ ክፉት ክኸውን እንተ ኣቐሚጥካዮ aria-expanded="true"፡ ኣብ ክንድኡ ኣብቲ ቁጽጽር ኣቐምጦ። እቲ ፕላግ-ኢን ነዚ ባህሪ ኣብቲ ቁጽጽር ብኣውቶማቲክ ክቕይሮ እዩ እቲ ዝዕጾ ባእታ ተኸፊቱ ወይ ተዓጽዩ ድዩ ኣይተዓጽወን (ብመንገዲ ጃቫስክሪፕት፣ ወይ እቲ ተጠቃሚ ካልእ ናይ ምቁጽጻር ባእታ እውን ምስ ተመሳሳሊ ዝዕጾ ባእታ ዝተኣሳሰር ስለዘበገሰ) መሰረት ብምግባር። ናይቲ ቁጽጽር ባእታ HTML ባእታ መጠወቒ እንተዘይኮይኑ (ንኣብነት፡ an <a>ወይ <div>)፡ እቲ ባህሪrole="button"ኣብቲ ባእታ ክውሰኽ ይግባእ።

ናትካ ናይ ምቁጽጻር ባእታ ንሓደ ዝዕጾ ባእታ ዒላማ ዝገብር እንተኾይኑ – ማለት እቲ data-targetባህሪ ናብ ሓደ መምረጺ ዘመልክት እንተኾይኑ – ነቲ ባህሪ ኣብቲ ናይ ምቁጽጻር ባእታ idክትውስኾ ይግባእ ፣ እቲ ናይቲ ዝዕጾ ባእታ ዝሓዘ። ዘመናውያን ስክሪን ሪደርን ተመሳሳሊ ሓገዝቲ ቴክኖሎጂታትን ነዚ ባህሪ እዚ ተጠቒሞም ተጠቀምቲ ብቐጥታ ናብቲ ዝዕጾ ባእታ ባዕሉ ንኽኸዱ ተወሳኺ ኣቋራጭ መገዲ ይህቡ።aria-controlsid

ኣስተውዕል ቡትስትራፕ ናይ ሕጂ ኣተገባብራ ነቶም ኣብ WAI-ARIA Authoring Practices 1.1 ኣኮርድዮን ቅዲ ዝተገልጹ ዝተፈላለዩ ናይ ቁልፊ ሰሌዳ ምትእስሳራት ከምዘይሽፍኖም ኣስተውዕል - ነዚኦም ባዕልኻ ምስ ብሕታዊ ጃቫስክሪፕት ከተእትዎም ከድልየካ እዩ።

ኣጠቓቕማ

እቲ ናይ ምፍራስ ፕላግ-ኢን ነቲ ከቢድ ምልዓል ንምሕላው ውሑዳት ክፍልታት ይጥቀም፤

  • .collapseነቲ ትሕዝቶ ይሓብኦ
  • .collapse.showዝብል ትሕዝቶ የርኢ
  • .collapsingምስግጋር ምስ ተጀመረ ይውሰኽ፣ ምስተወድአ ድማ ይእለ

እዞም ክፍልታት ኣብ _transitions.scss.

ብመንገዲ ባህርያት ዳታ

በቃ ኣብቲ ባእታ ምውሳኽን data-toggle="collapse"a ን ንኣውቶማቲክ ምቁጽጻር ናይ ሓደ ወይ ልዕሊኡ ዝዕጸፍ ባእታታት ንምምዳብ። data-targetእቲ data-targetባህሪ ነቲ ምዕጻፍ ክትጥቀመሉ እትኽእል CSS መምረጺ ይቕበል። collapseነቲ ክፍሊ ኣብቲ ዝዕጾ ባእታ ምውሳኽካ ኣረጋግጽ ። ብነባሪ ክኽፈት እንተደሊኻ፡ ነቲ ተወሳኺ ክፍሊ ወስኸሉ show

ኣኮርድዮን ዝመስል ምሕደራ ጉጅለ ኣብ ዝዕጸፍ ቦታ ንምውሳኽ፡ ነቲ ናይ ዳታ ባህሪ ወስኸሉ data-parent="#selector"። ነዚ ብተግባር ንምርኣይ ኣብቲ ዲሞ ተወከሱ።

ብመንገዲ ጃቫስክሪፕት።

ብኢድካ ምስ ኣንቅሕ፤

$('.collapse').collapse()

ኣማራጺታት

ኣማራጺታት ብመንገዲ ዳታ ​​ባህርያት ወይ ጃቫስክሪፕት ክሓልፉ ይኽእሉ። ንባህርያት ዳታ፡ ስም ኣማራጺ ናብ ምውሳኽ data-፡ ከምቲ ኣብ data-parent="".

ሽም ዓይነት ትሑዝ መግለፂ
ወላዲ መምረጺ | jQuery ነገር | DOM ባእታ ሓሶት ወላዲ እንተተዋሂቡ፡ ሽዑ ኩሎም ኣብ ትሕቲ እቲ ዝተገልጸ ወላዲ ዝዕጸፉ ባእታታት እዚ ዝዕጸፍ ኣቕሓ ምስ ዝረአ ክዕጸዉ እዮም። card(ምስ ባህላዊ ባህሪ ኣኮርድዮን ዝመሳሰል - እዚ ኣብቲ ክፍሊ ዝምርኮስ እዩ )። እቲ ባህሪ ኣብቲ ዕላማ ዝዕጾ ቦታ ክቕመጥ ኣለዎ።
toggle ምግባር ቡልያን ዝብል እዩ። ሓቂ ኣብ ምጽዋዕ ነቲ ዝዕጾ ባእታ ይቕይሮ

ኣገባባት

ዘይተመዓራረዩ ኣገባባትን ምስግጋራትን።

ኩሎም ናይ ኤፒኣይ ሜላታት ዘይተመዓራረዩ ኮይኖም ምስግጋር ይጅምሩ ። እቲ ምስግጋር ምስ ተጀመረ ግን ከኣ ቅድሚ ምውድኡ ናብቲ ደዋሊ ይምለሱ ። ብተወሳኺ፡ ኣብ ሓደ መሰጋገሪ ኣካል ዝግበር ናይ ሜላ ጻውዒት ዕሽሽ ክበሃል እዩ .

ንዝያዳ ሓበሬታ ኣብ ሰነድ ጃቫስክሪፕትና ርአ

.collapse(options)

Activates your content as a collapsible element. Accepts an optional options object.

$('#myCollapsible').collapse({
  toggle: false
})

.collapse('toggle')

Toggles a collapsible element to shown or hidden. Returns to the caller before the collapsible element has actually been shown or hidden (i.e. before the shown.bs.collapse or hidden.bs.collapse event occurs).

.collapse('show')

Shows a collapsible element. Returns to the caller before the collapsible element has actually been shown (i.e. before the shown.bs.collapse event occurs).

.collapse('hide')

Hides a collapsible element. Returns to the caller before the collapsible element has actually been hidden (i.e. before the hidden.bs.collapse event occurs).

.collapse('dispose')

Destroys an element’s collapse.

Events

Bootstrap’s collapse class exposes a few events for hooking into collapse functionality.

Event Type Description
show.bs.collapse showእዚ ፍጻመ እዚ እቲ ናይ ምሳሌ ሜላ ምስ ዝጽዋዕ ብቕጽበት ይትኩስ ።
shown.bs.collapse ዝብል ጽሑፍ ኣሎ። እዚ ክስተት ዝትኮስ ሓደ ናይ ምፍራስ ባእታ ንተጠቃሚ ርኡይ ምስ ተገይሩ እዩ (ምስግጋር CSS ክሳብ ዝዛዘም ክጽበ እዩ)።
hide.bs.collapse ዝብል ጽሑፍ ኣሎ። እዚ ፍጻመ እዚ እቲ hideሜላ ምስ ተጸውዐ ብቕጽበት ይትኮስ።
ሕቡእ.bs.collapse ዝብል ጽሑፍ ኣሎ። እዚ ክስተት ዝትኮስ ሓደ ናይ ምፍራስ ባእታ ካብ ተጠቃሚ ምስ ተሓብአ እዩ (CSS ምስግጋራት ክሳብ ዝዛዘም ክጽበ እዩ)።
$('#myCollapsible').on('hidden.bs.collapse', function () {
  // do something...
})