Bootstrap JS Toasts
نخب فئات CSS
يشبه مكون Toast مربع تنبيه يظهر فقط لبضع ثوانٍ عند حدوث شيء ما (على سبيل المثال ، عندما ينقر المستخدم على زر ، أو يرسل نموذجًا ، وما إلى ذلك).
للحصول على برنامج تعليمي حول الخبز المحمص ، اقرأ البرنامج التعليمي Bootstrap Toast الخاص بنا .
Class | Description | Example |
---|---|---|
.toast |
Creates the toast | |
.toast-header |
Creates the toast header | |
.toast-body |
Creates the toast body |
التنشيط عبر JavaScript
يجب تهيئة الخبز المحمص باستخدام jQuery: حدد العنصر المحدد واستدعاء toast()
الطريقة.
مثال
<script>
$(document).ready(function(){
$('.toast').toast('show');
});
</script>
خيارات التوست
يمكن تمرير الخيارات عبر سمات البيانات أو JavaScript. لسمات البيانات ، قم بإلحاق اسم الخيار بـ data-
، كما في data-animation=""
.
Name | Type | Default | Description | Try it |
---|---|---|---|---|
animation | boolean | true |
Specifies whether to add a CSS fade transition effect when showing and hiding the toast.
|
|
autohide | boolean | true | Specifies whether to hide the toast by default | |
delay | number | 500 | Specifies the number of milliseconds it will take to hide the toast once it is shown. |
طرق الخبز المحمص
يسرد الجدول التالي جميع طرق الخبز المحمص المتاحة.
Method | Description | Try it |
---|---|---|
.toast(options) | Activates the toast with an option. See options above for valid values | |
.toast("show") | Shows the toast | |
.toast("hide") | Hides the toast | |
.toast("dispose") | Hides and destroys the toast |
نخب الأحداث
يسرد الجدول التالي جميع الأحداث المحمصة المتاحة.
Event | Description | Try it |
---|---|---|
show.bs.toast | Occurs when the toast is about to be shown | |
shown.bs.toast | Occurs when the toast is fully shown (after CSS transitions have completed) | |
hide.bs.toast | Occurs when the toast is about to be hidden | |
hidden.bs.toast | Occurs when the toast is fully hidden (after CSS transitions have completed) |