Explore the capabilities of your custom JavaScript slider.
Get your Horizon Slider up and running in minutes! Follow these simple steps to integrate it into your project.
Add these lines to the `head` section of your HTML file.
<!-- Horizon Slider CSS --> <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/mansurivilla/horizonslider/prod/css/HorizonSlider.min.css"> <!-- GSAP Core (required by Draggable) --> <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.11.4/gsap.min.js"></script>
Use this basic structure for each slider you want to create. Customize the `slide` content as needed.
<!-- Your Slider Container --> <div class="horizon-slider_container my-custom-slider"> <div class="horizon-slider_track"> <div class="horizon-slide">Your Slide Content 1</div> <div class="horizon-slide">Your Slide Content 2</div> <div class="horizon-slide">Your Slide Content 3</div> <!-- Add more slides as needed --> </div> <!-- Navigation and tracker will be dynamically generated here --> </div>
Place this script just before your closing `</body>` tag. Remember to link your Horizon Slider JS file.
<!-- Horizon Slider JavaScript --> <script src="https://cdn.jsdelivr.net/gh/mansurivilla/horizonslider/prod/js/HorizonSlider.min.js"></script> <script> // Initialize your slider(s) horizonSlider({ '.my-custom-slider': { // Use the class name of your slider container loop: true, margin: 20, nav: true, showTracker: true, drag: true, autoplay: { delay: 4000, pauseOnHover: true }, responsive: { 0: { items: 1 }, // 1 item on screens < 768px 768: { items: 2 }, // 2 items on screens >= 768px 1024: { items: 3 } // 3 items on screens >= 1024px } } }); </script>
A simple implementation showing the core slider functionality with default navigation, tracker, and draggable support.
Experience smooth automatic transitions. Hover over the slider to pause the autoplay, and it will resume when your mouse leaves.
This slider demonstrates how to disable the dragging feature. Navigation is controlled solely by the previous/next buttons.
See how Horizon Slider handles image-rich content, adapting seamlessly to various media types.
This slider demonstrates how to disable the dragging feature. Navigation is controlled solely by the previous/next buttons.