Source

ፈረሰ

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

ኣብነት

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

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

ኣኮርድዮን ኣብነት

ነቲ ናይ ካርድ ክፍሊ ብምጥቃም፡ ነቲ ነባሪ ናይ ምዕጻፍ ባህሪ ከተናውሖ ትኽእል ኢኻ ኣኮርድዮን ክትፈጥር።

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 id="accordion">
  <div class="card">
    <div class="card-header" id="headingOne">
      <h5 class="mb-0">
        <button class="btn btn-link" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
          Collapsible Group Item #1
        </button>
      </h5>
    </div>

    <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
      <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">
      <h5 class="mb-0">
        <button class="btn btn-link collapsed" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
          Collapsible Group Item #2
        </button>
      </h5>
    </div>
    <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordion">
      <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">
      <h5 class="mb-0">
        <button class="btn btn-link collapsed" data-toggle="collapse" data-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
          Collapsible Group Item #3
        </button>
      </h5>
    </div>
    <div id="collapseThree" class="collapse" aria-labelledby="headingThree" data-parent="#accordion">
      <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)

ትሕዝቶኻ ከም ዝዕጾ ባእታ ይንቀሳቐስ። ሓደ ኣማራጺ ኣማራጺታት ይቕበል object.

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

.collapse('toggle')

ንሓደ ዝዕጾ ባእታ ናብ ዝተራእየ ወይ ዝተሓብአ ይቕይሮ። እቲ ዝዕጾ ባእታ ብጭቡጥ ቅድሚ ምርኣዩ ወይ ምሕባኡ (ማለት ቅድሚ እቲ shown.bs.collapseወይ hidden.bs.collapseፍጻመ ምፍጻሙ) ናብቲ ደዋሊ ይምለስ።

.collapse('show')

ዝዕጾ ባእታ የርኢ። እቲ ዝዕጾ ባእታ ብጭቡጥ ቅድሚ ምርኣይ (ማለት ቅድሚ እቲ shown.bs.collapseፍጻመ ምፍጻሙ) ናብቲ ደዋሊ ይምለስ።

.collapse('hide')

ዝዕጾ ባእታ ይሓብእ። እቲ ዝዕጾ ባእታ ብጭቡጥ ቅድሚ ምሕባኡ (ማለት ቅድሚ እቲ hidden.bs.collapseፍጻመ ምፍጣሩ) ናብቲ ደዋሊ ይምለስ።

.collapse('dispose')

ናይ ሓደ ባእታ ምፍራስ የጥፍእ።

ፍጻሜታት

ናይ ቡትስትራፕ ናይ ምፍራስ ክፍሊ ንውሑዳት ፍጻመታት ንናይ ምፍራስ ተግባር ምትእስሳር የቃልዕ።

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