ናብ ቀንዲ ትሕዝቶ ዘልል ናብ docs navigation ዘልል
in English

ካብ ካንቫስ ወጻኢ

ኣብ ፕሮጀክትካ ንመጓዓዝያ፣ ናይ ዕዳጋ ዓረብያታትን ካልእን ብውሑዳት ክፍልታትን ናይ ጃቫስክሪፕት ፕላግ-ኢንናን ዝተሓብኡ ጎድናዊ መስመር ምህናጽ።

ከመይ ይሰርሕ

Offcanvas ብጃቫስክሪፕት ኣቢልካ ካብ ጸጋማይ፡ የማናይ ወይ ታሕተዋይ ወሰን ናይቲ ቪውፖርት ክረአ ዝኽእል ናይ ጎድናዊ ባር ክፍሊ እዩ። መጠወቒታት ወይ መልህቕ ከም መበገሲታት ኮይኖም ምስ ፍሉያት ባእታታት ትቕይሮም ዝተተሓሓዙ ይጥቀሙ፣ dataባህርያት ድማ ንጃቫስክሪፕትና ንምጽዋዕ ይጥቀሙ።

  • Offcanvas ገለ ካብ ሓደ ዓይነት ናይ ጃቫስክሪፕት ኮድ ከም ሞዳላት ይካፈል። ብኣምር ኣዝዮም ተመሳሰልቲ እዮም፡ ግን ከኣ ዝተፈላለዩ ፕላግ-ኢናት እዮም።
  • ብተመሳሳሊ ገለ ምንጪ Sass ተለዋዋጢ ናይ offcanvas ቅዲታትን መለክዒታትን ካብ ሞዳል ተቐያየርቲ ይውረስ።
  • ምስ ዝረአ፡ offcanvas ነቲ offcanvas ንምሕባእ ክትጥውቖ እትኽእል ነባሪ ድሕረ ባይታ የጠቓልል።
  • ምስ ሞዳላት ዝመሳሰል ኣብ ሓደ እዋን ሓደ ኦፍካንቫስ ጥራይ እዩ ክረአ ዝኽእል።

ርእሲ ንላዕሊ! marginCSS ንኣኒሜሽን ብኸመይ ከም ዝሕዞ ኣብ ግምት ብምእታው፡ ክትጥቀመሉ ወይ translateኣብ ልዕሊ ሓደ .offcanvasባእታ ክትጥቀመሉ ኣይትኽእልን ኢኻ ። ኣብ ክንድኡስ፡ ነቲ ክፍሊ ከም ናጻ መጠቕለሊ ባእታ ተጠቐመሉ።

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

ኣብነታት

ካብ ካንቫስ ወጻኢ ዝኾኑ ኣካላት

ኣብ ታሕቲ ብነባሪ (ብመንገዲ .showon .offcanvas) ዝረአ ናይ offcanvas ኣብነት ኣሎ። Offcanvas ንሓደ ርእሲ ምስ ምዕጻው መጠወቒ ደገፍን ንገለ መጀመርታ ዝኸውን ኣማራጺ ኣካል ክፍሊን የጠቓልል padding። ብዝተኻእለ መጠን ካብ ካንቫስ ወጻኢ ዝኾኑ ርእስታት ምስ ናይ ምብራር ተግባራት ከተካትቱ፡ ወይ ድማ ብግልጺ ናይ ምብራር ስጉምቲ ክትህቡ ንመክር።

ካብ ካንቫስ ወጻኢ
ትሕዝቶ ናይቲ offcanvas ኣብዚ ይኸይድ። ዳርጋ ዝኾነ ናይ Bootstrap ክፍሊ ወይ ብሕታዊ ባእታታት ኣብዚ ከተቐምጥ ትኽእል ኢኻ።
<div class="offcanvas offcanvas-start" tabindex="-1" id="offcanvas" aria-labelledby="offcanvasLabel">
  <div class="offcanvas-header">
    <h5 class="offcanvas-title" id="offcanvasLabel">Offcanvas</h5>
    <button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
  </div>
  <div class="offcanvas-body">
    Content for the offcanvas goes here. You can place just about any Bootstrap component or custom elements here.
  </div>
</div>

ቀጥታዊ ዲሞ

ኣብ ታሕቲ ዘለዉ መጠወቒታት ተጠቐም ንሓደ ካብ ካንቫስ ወጻኢ ዝኾነ ባእታ ብመንገዲ ጃቫስክሪፕት ንምርኣይን ንምሕባእን ነቲ .showክፍሊ ኣብ ሓደ ባእታ ምስቲ .offcanvasክፍሊ ዝቕይሮ።

  • .offcanvasትሕዝቶ ይሓብእ (ነባሪ)
  • .offcanvas.showትሕዝቶ የርኢ

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

ምስ href ምትእስሳር
ካብ ካንቫስ ወጻኢ
ገለ ጽሑፍ ከም ቦታ መትሓዚ። ኣብ ሓቀኛ ህይወት ዝመረጽካዮም ባእታታት ክህልዉኻ ይኽእሉ እዮም። ከም፡ ጽሑፍ፡ ምስልታት፡ ዝርዝር ወዘተ።
<a class="btn btn-primary" data-bs-toggle="offcanvas" href="#offcanvasExample" role="button" aria-controls="offcanvasExample">
  Link with href
</a>
<button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasExample" aria-controls="offcanvasExample">
  Button with data-bs-target
</button>

<div class="offcanvas offcanvas-start" tabindex="-1" id="offcanvasExample" aria-labelledby="offcanvasExampleLabel">
  <div class="offcanvas-header">
    <h5 class="offcanvas-title" id="offcanvasExampleLabel">Offcanvas</h5>
    <button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
  </div>
  <div class="offcanvas-body">
    <div>
      Some text as placeholder. In real life you can have the elements you have chosen. Like, text, images, lists, etc.
    </div>
    <div class="dropdown mt-3">
      <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-bs-toggle="dropdown">
        Dropdown button
      </button>
      <ul class="dropdown-menu" aria-labelledby="dropdownMenuButton">
        <li><a class="dropdown-item" href="#">Action</a></li>
        <li><a class="dropdown-item" href="#">Another action</a></li>
        <li><a class="dropdown-item" href="#">Something else here</a></li>
      </ul>
    </div>
  </div>
</div>

ምምዳብ

ንናይ offcanvas ኣካላት ነባሪ ምቕማጥ የለን፣ ስለዚ ሓደ ካብቶም ኣብ ታሕቲ ዘለዉ ናይ መቐየሪ ክፍልታት ክትውስኽ ኣለካ፤

  • .offcanvas-startoffcanvas ኣብ ጸጋማይ ሸነኽ ናይቲ ቪውፖርት የቐምጦ (ኣብ ላዕሊ ተገሊጹ ኣሎ)
  • .offcanvas-endoffcanvas ኣብ የማናይ ሸነኽ ናይቲ ቪውፖርት የቐምጦ
  • .offcanvas-topoffcanvas ኣብ ላዕሊ ናይቲ ቪውፖርት የቐምጦ
  • .offcanvas-bottomoffcanvas ኣብ ታሕቲ ናይቲ ቪውፖርት የቐምጦ

ኣብ ታሕቲ ዘሎ ላዕለዋይን የማንን ታሕተዋይን ኣብነታት ፈትን።

ካብ ካንቫስ ወጻኢ ዝኾነ ላዕለዋይ ክፋል
...
<button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasTop" aria-controls="offcanvasTop">Toggle top offcanvas</button>

<div class="offcanvas offcanvas-top" tabindex="-1" id="offcanvasTop" aria-labelledby="offcanvasTopLabel">
  <div class="offcanvas-header">
    <h5 id="offcanvasTopLabel">Offcanvas top</h5>
    <button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
  </div>
  <div class="offcanvas-body">
    ...
  </div>
</div>
ኦፍካንቫስ ትኽክል
...
<button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasRight" aria-controls="offcanvasRight">Toggle right offcanvas</button>

<div class="offcanvas offcanvas-end" tabindex="-1" id="offcanvasRight" aria-labelledby="offcanvasRightLabel">
  <div class="offcanvas-header">
    <h5 id="offcanvasRightLabel">Offcanvas right</h5>
    <button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
  </div>
  <div class="offcanvas-body">
    ...
  </div>
</div>
ካብ ካንቫስ ወጻኢ ዝኾነ ታሕተዋይ ክፋል
...
<button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasBottom" aria-controls="offcanvasBottom">Toggle bottom offcanvas</button>

<div class="offcanvas offcanvas-bottom" tabindex="-1" id="offcanvasBottom" aria-labelledby="offcanvasBottomLabel">
  <div class="offcanvas-header">
    <h5 class="offcanvas-title" id="offcanvasBottomLabel">Offcanvas bottom</h5>
    <button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
  </div>
  <div class="offcanvas-body small">
    ...
  </div>
</div>

ድሕረ ባይታ

<body>ንሓደ offcanvasን ድሕረ ባይታኡን ምስ ዝረአ ነቲ ባእታ ምዝዋር ይስረዝ። ነቲ data-bs-scrollባህሪ ንመጠምጠምያ <body>ንምቕያርን data-bs-backdropነቲ ድሕረ ባይታ ንምቕያርን ተጠቐመሉ።

ምስ ስክሮሊንግ ሕብሪ ዘለዎ

ነዚ ኣማራጺ ብተግባር ንምርኣይ ነቲ ዝተረፈ ገጽ ክትስክሮል ፈትን።

ካብ ካንቫስ ወጻኢ ምስ ድሕረ ባይታ

.....

ብስክሮሊንግ ዝተሰርሐ ድሕረ ባይታ ዘለዎ

ነዚ ኣማራጺ ብተግባር ንምርኣይ ነቲ ዝተረፈ ገጽ ክትስክሮል ፈትን።

<button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasScrolling" aria-controls="offcanvasScrolling">Enable body scrolling</button>
<button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasWithBackdrop" aria-controls="offcanvasWithBackdrop">Enable backdrop (default)</button>
<button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasWithBothOptions" aria-controls="offcanvasWithBothOptions">Enable both scrolling & backdrop</button>

<div class="offcanvas offcanvas-start" data-bs-scroll="true" data-bs-backdrop="false" tabindex="-1" id="offcanvasScrolling" aria-labelledby="offcanvasScrollingLabel">
  <div class="offcanvas-header">
    <h5 class="offcanvas-title" id="offcanvasScrollingLabel">Colored with scrolling</h5>
    <button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
  </div>
  <div class="offcanvas-body">
    <p>Try scrolling the rest of the page to see this option in action.</p>
  </div>
</div>
<div class="offcanvas offcanvas-start" tabindex="-1" id="offcanvasWithBackdrop" aria-labelledby="offcanvasWithBackdropLabel">
  <div class="offcanvas-header">
    <h5 class="offcanvas-title" id="offcanvasWithBackdropLabel">Offcanvas with backdrop</h5>
    <button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
  </div>
  <div class="offcanvas-body">
    <p>.....</p>
  </div>
</div>
<div class="offcanvas offcanvas-start" data-bs-scroll="true" tabindex="-1" id="offcanvasWithBothOptions" aria-labelledby="offcanvasWithBothOptionsLabel">
  <div class="offcanvas-header">
    <h5 class="offcanvas-title" id="offcanvasWithBothOptionsLabel">Backdroped with scrolling</h5>
    <button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
  </div>
  <div class="offcanvas-body">
    <p>Try scrolling the rest of the page to see this option in action.</p>
  </div>
</div>

ተበጻሕነት

እቲ ካብ ካንቫስ ወጻኢ ዝኾነ ፓነል ብኣምር ሞዳል ዝርርብ ስለ ዝኾነ፡ ርግጸኛ ኩን ምውሳኽ aria-labelledby="..."—ነቲ ካብ ካንቫስ ወጻኢ ዝኾነ ኣርእስቲ ብምውካስ—ኣብ .offcanvas. role="dialog"ድሮ ብጃቫስክሪፕት ስለ ዝወሰኽናዮ ምውሳኽ ኣየድልየኩምን ምዃኑ ኣስተውዕል ።

ሳስ

ተለዋዋጢ ረቛሒታት

$offcanvas-padding-y:               $modal-inner-padding;
$offcanvas-padding-x:               $modal-inner-padding;
$offcanvas-horizontal-width:        400px;
$offcanvas-vertical-height:         30vh;
$offcanvas-transition-duration:     .3s;
$offcanvas-border-color:            $modal-content-border-color;
$offcanvas-border-width:            $modal-content-border-width;
$offcanvas-title-line-height:       $modal-title-line-height;
$offcanvas-bg-color:                $modal-content-bg;
$offcanvas-color:                   $modal-content-color;
$offcanvas-box-shadow:              $modal-content-box-shadow-xs;

ኣጠቓቕማ

እቲ ካብ ካንቫስ ወጻኢ ዝኾነ ፕላግ-ኢን ነቲ ከቢድ ምልዓል ንምሕላው ውሑዳት ክፍልታትን ባህርያትን ይጥቀም፤

  • .offcanvasነቲ ትሕዝቶ ይሓብኦ
  • .offcanvas.showዝብል ትሕዝቶ የርኢ
  • .offcanvas-startነቲ offcanvas ብጸጋማይ ሸነኽ ይሓብኦ
  • .offcanvas-endነቲ offcanvas ብየማን ይሓብኦ
  • .offcanvas-bottomነቲ offcanvas ኣብ ታሕቲ ይሓብኦ

ምስቲ ባህሪ ናይ ምብራር መጠወቒ ወስኸሉ data-bs-dismiss="offcanvas"፣ እዚ ድማ ንተግባር ጃቫስክሪፕት የበግሶ። <button>ኣብ ኩሎም መሳርሒታት ንዝግባእ ባህሪ ነቲ ባእታ ምስኡ ምጥቃምካ ኣረጋግጽ ።

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

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

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

ብኢድካ ምስ ኣንቅሕ፤

var offcanvasElementList = [].slice.call(document.querySelectorAll('.offcanvas'))
var offcanvasList = offcanvasElementList.map(function (offcanvasEl) {
  return new bootstrap.Offcanvas(offcanvasEl)
})

ኣማራጺታት

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

ሽም ዓይነት ትሑዝ መግለፂ
backdrop ቡልያን ዝብል እዩ። true offcanvas ክፉት ከሎ ኣብ ኣካላት ድሕረ ባይታ ምልካይ
keyboard ቡልያን ዝብል እዩ። true መፍትሕ ምህዳም ምስ ዝጽቀጥ ነቲ offcanvas ይዓጽዎ።
scroll ቡልያን ዝብል እዩ። false offcanvas ክፉት ከሎ ኣካላት ምዝዋር ፍቐድ

ኣገባባት

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

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

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

ትሕዝቶኻ ከም ካብ ካንቫስ ወጻኢ ዝኾነ ባእታ የነቓቕሖ። ሓደ ኣማራጺ ኣማራጺታት ይቕበል object.

ብሃናጺ ካብ ካንቫስ ወጻኢ ዝኾነ ምሳሌ ክትፈጥር ትኽእል ኢኻ፣ ንኣብነት፤

var myOffcanvas = document.getElementById('myOffcanvas')
var bsOffcanvas = new bootstrap.Offcanvas(myOffcanvas)
ሜላ መግለፂ
toggle ንሓደ ካብ ካንቫስ ወጻኢ ዝኾነ ባእታ ናብ ዝተራእየ ወይ ዝተሓብአ ይቕይሮ። ቅድሚ እቲ ካብ ካንቫስ ወጻኢ ዝኾነ ባእታ ብጭቡጥ ምርኣይ ወይ ምሕባኡ (ማለት ቅድሚ እቲ shown.bs.offcanvasወይ hidden.bs.offcanvasፍጻመ ምፍጣሩ) ናብቲ ደዋሊ ይምለስ።
show ካብ ካንቫስ ወጻኢ ዝኾነ ባእታ የርኢ። ቅድሚ እቲ ካብ ካንቫስ ወጻኢ ዝኾነ ባእታ ብጭቡጥ ምርኣይ (ማለት ቅድሚ እቲ shown.bs.offcanvasፍጻመ ምፍጻሙ) ናብቲ ደዋሊ ይምለስ።
hide ካብ ካንቫስ ወጻኢ ዝኾነ ባእታ ይሓብእ። እቲ ካብ ካንቫስ ወጻኢ ዝኾነ ባእታ ብጭቡጥ ቅድሚ ምሕባኡ (ማለት ቅድሚ እቲ hidden.bs.offcanvasፍጻመ ምፍጣሩ) ናብቲ ደዋሊ ይምለስ።
getInstance ምስ ሓደ DOM element ዝተኣሳሰር offcanvas instance ክትረክብ ዘኽእለካ ስታቲክ ሜላ
getOrCreateInstance ስታትቲክ ሜላ እዚ ድማ ነቲ offcanvas instance ምስ DOM element ዝተኣሳሰር ክትረኽቦ ዘኽእለካ፣ ወይ ድማ እንተዘይተጀ��ሩ ሓድሽ ክትፈጥር ዘኽእለካ

ፍጻሜታት

Bootstrap's offcanvas class ንውሑዳት ፍጻመታት ናብ offcanvas ተግባር ምትእስሳር የቃልዕ።

ዓይነት ፍጻመ መግለፂ
show.bs.offcanvas showእዚ ፍጻመ እዚ እቲ ናይ ምሳሌ ሜላ ምስ ዝጽዋዕ ብቕጽበት ይትኩስ ።
shown.bs.offcanvas እዚ ክስተት ዝትኮስ ሓደ ካብ ካንቫስ ወጻኢ ዝኾነ ባእታ ንተጠቃሚ ክርአ ምስ ተገብረ እዩ (ምስግጋር CSS ክሳብ ዝዛዘም ክጽበ እዩ)።
hide.bs.offcanvas እዚ ፍጻመ እዚ እቲ hideሜላ ምስ ተጸውዐ ብቕጽበት ይትኮስ።
hidden.bs.offcanvas እዚ ክስተት ዝትኮስ ሓደ ካብ ካንቫስ ወጻኢ ዝኾነ ባእታ ካብ ተጠቃሚ ምስ ተሓብአ እዩ (ምስግጋር CSS ክሳብ ዝዛዘም ክጽበ እዩ)።
var myOffcanvas = document.getElementById('myOffcanvas')
myOffcanvas.addEventListener('hidden.bs.offcanvas', function () {
  // do something...
})