برای نگهدارنده اصلی کروسل استفاده میشود. نگهدارندۀ اصلی، تمام اجزای کروسل را دربرمیگیرد.
Slide
انیمیشن اسلاید را در هنگام تغییر اسلایدها فعال میکند.
carousel-inner
برای نگهدارندۀ عناصر اسلاید بهکار میرود.
carousel-item
برای هر اسلاید در کروسل استفاده میشود. عنصری که دارای کلاس carousel-item است، محتوای اسلاید (تصاویر، متن و...) را در برمیگیرد.
active
مشخص میکند کدام اسلاید در حال حاضر نمایش داده میشود.
carousel-control-prev
برای دکمۀ انتقال به اسلاید قبلی استفاده میشود.
carousel-control-next
برای دکمۀ انتقال به اسلاید بعدی استفاده میشود.
carousel-indicators
برای ایجاد نشانگرهای روی اسلاید استفاده میشود؛ دایرههای کوچکی که نشان میدهند چند اسلاید وجود دارد و در حال حاضر کدام اسلاید نمایش داده میشود.
carousel-caption
برای افزودن متن یا توضیحات به اسلایدهای کروسل استفاده میشود.
صفحه ۱۸۶
آکاردئون
آکاردئون یکی از اجزای کاربردی بوتاسترت است که به توسعهدهنده امکان میدهد محتوا را در بخشهای قابل باز و بسته شدن نمایش دهد. آکاردئون بهصورت پیشفرض بسته است. با کلیک روی عنوان هر بخش، محتوای مربوط به آن ظاهر میشود و با کلیک بعدی مخفی میگردد. این ویژگی برای سازماندهی محتوای طولانی و نمایش اطلاعات به صورت فشرده بسیار مفید است.
آکاردئون میتواند در طراحی بخشهای مختلفی کاربرد داشته باشد؛ مانند منوی ناوبری و کشویی، نمایش اطلاعات تکمیلی یک بخش، ایجاد بخش سوالات متداول و غیره.
صفحه ۱۸۷
در طراحی یک آکاردئون کلاسهای مختلفی استفاده میشود. جدول ۱۴ اسامی کلاسها و کاربرد هر یک را نشان میدهد.
جدول ۱۴: کلاسهای آکاردئون
نام کلاس
کاربرد
Accordion
این کلاس برای ایجاد نگهدارنده اصلی آکاردئون استفاده میشود و تمام عناصر آکاردئون را در بر میگیرد.
Accordion-item
یک آکاردئون دارای چند بخش (Item) است که هر بخش مجزا از این کلاس استفاده میکند. هر بخش شامل یک header و یک محتوای قابل جمع شدن است.
Accordion-header
این کلاس برای ایجاد header در هر بخش استفاده میشود و معمولاً شامل یک دکمه یا پیوند است که با کلیک بر روی آن، محتوای مربوط به آن بخش آشکار یا مخفی میشود.
Accordion-button
استایل دکمهای که روی آن کلیک میشود را تعیین میکند.
Accordion-collapse
این کلاس برای تعیین استایل عنصری که محتوای قابل جمع شدن دارد بهکار میرود.
Accordion-body
این کلاس برای ایجاد محتوای قابل نمایش در هر بخش (Item) استفاده میشود.
Collapse
برای باز و بسته شدن محتوا بهکار میرود.
show
این کلاس باعث میشود که محتوای یک عنصر بهصورت باز نمایش داده شود.
عنصر <div> با کلاس accordion-item باید به تعداد بخشهای آکاردئون استفاده شود.
صفحه ۱۸۸
صفحه ۱۸۹
Page 185
Table 13: Carousel classes
Class name
Use
Carousel
Used for the main container of the carousel, which holds all its parts.
Slide
Turns on the slide animation when the slides change.
carousel-inner
Used for the container of the slide elements.
carousel-item
Used for each slide of the carousel. The element with the class carousel-item holds the slide's content (images, text, and so on).
active
Marks which slide is being shown now.
carousel-control-prev
Used for the button that goes to the previous slide.
carousel-control-next
Used for the button that goes to the next slide.
carousel-indicators
Used to create the indicators on the slide: small circles that show how many slides there are and which one is being shown.
carousel-caption
Used to add text or captions to the carousel slides.
Page 186
Accordion
The accordion is one of Bootstrap's useful components; it lets the developer show content in sections that open and close. The accordion is closed by default. Clicking the title of a section shows its content, and clicking again hides it. This is very useful for organizing long content and showing information compactly.
Accordions can be used in many parts of a design, such as navigation and drop-down menus, showing extra information about a section, building a frequently asked questions section, and so on.
Page 187
Several classes are used to design an accordion. Table 14 shows the class names and what each one does.
Table 14: Accordion classes
Class name
Use
Accordion
Creates the main container of the accordion, which holds all its elements.
Accordion-item
An accordion has several sections (Item), each of which uses this class. Each section has a header and collapsible content.
Accordion-header
Creates the header of each section; it usually holds a button or link that shows or hides the content of that section when clicked.
Accordion-button
Sets the style of the button that is clicked.
Accordion-collapse
Used to style the element that holds the collapsible content.
Accordion-body
Creates the content shown in each section (Item).
Collapse
Used to open and close the content.
show
Shows the content of an element open.
There must be one <div> element with the class accordion-item for each section of the accordion.