Slider Bootstrap đẹp
The carousel is a slideshow for cycling through a series of content, built with CSS 3D transforms and a bit of JavaScript. It works with a series of images, text, or custom markup. It also includes support for previous/next controls and indicators. In browsers where the Page Visibility API is supported, the carousel will avoid sliding when the webpage is not visible to the user (such as when the browser tab is inactive, the browser window is minimized, etc.). Please be aware that nested carousels are not supported, and carousels are generally not compliant with accessibility standards. Lastly, if you’re building our JavaScript from source, it . ExampleCarousels don’t automatically normalize slide dimensions. As such, you may need to use additional utilities or custom styles to appropriately size content. While carousels support previous/next controls and indicators, they’re not explicitly required. Add and customize as you see fit. Be sure to set a unique id on the Slides onlyHere’s a carousel with slides only. Note the presence of the 0 on carousel images to prevent browser default image alignment.
With controlsAdding in the previous and next controls:
You can also add the indicators to the carousel, alongside the controls, too.
Initial active element requiredThe 1 class needs to be added to one of the slides. Otherwise, the carousel will not be visible.With captionsAdd captions to your slides easily with the 2 element within any 3. They can be easily hidden on smaller viewports, as shown below, with optional display utilities. We hide them initially with 4 and bring them back on medium-sized devices with 5.
...... UsageVia data attributesUse data attributes to easily control the position of the carousel. 6 accepts the keywords 7 or 8, which alters the slide position relative to its current position. Alternatively, use 9 to pass a raw slide index to the carousel 0, which shifts the slide position to a particular index beginning with 1.The 2 attribute is used to mark a carousel as animating starting at page load. It cannot be used in combination with (redundant and unnecessary) explicit JavaScript initialization of the same carousel.Via JavaScriptCall carousel manually with:
OptionsOptions can be passed via data attributes or JavaScript. For data attributes, append the option name to 3, as in 4.NameTypeDefaultDescriptionintervalnumber5000The amount of time to delay between automatically cycling an item. If false, carousel will not automatically cycle.keyboardbooleantrueWhether the carousel should react to keyboard events.pausestring | boolean"hover"If set to 5, pauses the cycling of the carousel on 6 and resumes the cycling of the carousel on 7. If set to 8, hovering over the carousel won't pause it.On touch-enabled devices, when set to 5, cycling will pause on 0 (once the user finished interacting with the carousel) for two intervals, before automatically resuming. Note that this is in addition to the above mouse behavior.ridestringfalseAutoplays the carousel after the user manually cycles the first item. If "carousel", autoplays the carousel on load.wrapbooleantrueWhether the carousel should cycle continuously or have hard stops.MethodsAsynchronous methods and transitionsAll API methods are asynchronous and start a transition. They return to the caller as soon as the transition is started but before it ends. In addition, a method call on a transitioning component will be ignored. See our JavaScript documentation for more information.
|