How to make a owl carousel with arrows instead of next previous

后端 未结 6 1412
没有蜡笔的小新
没有蜡笔的小新 2020-12-02 20:44

Yesterday I presented a website to a customer. I always use Owl carousel since it\'s responsive. The client, however, hated the previous, next words, and wanted to change th

相关标签:
6条回答
  • 2020-12-02 21:08

    If you're using Owl Carousel 2, then you should use the following:

    $(".category-wrapper").owlCarousel({
         items : 4,
         loop  : true,
         margin : 30,
         nav    : true,
         smartSpeed :900,
         navText : ["<i class='fa fa-chevron-left'></i>","<i class='fa fa-chevron-right'></i>"]
       });
    
    0 讨论(0)
  • 2020-12-02 21:11

    The following code works for me on owl carousel .

    https://github.com/OwlFonk/OwlCarousel

    $(".owl-carousel").owlCarousel({
        items: 1,
        autoplay: true,
        navigation: true,
        navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"]
    });
    

    For OwlCarousel2

    https://owlcarousel2.github.io/OwlCarousel2/docs/api-options.html

     $(".owl-carousel").owlCarousel({
        items: 1,
        autoplay: true,
        nav: true,
        navText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"]
    });
    
    0 讨论(0)
  • 2020-12-02 21:11

    This is how you do it in your $(document).ready() function with FontAwesome Icons:

     $( ".owl-prev").html('<i class="fa fa-chevron-left"></i>');
     $( ".owl-next").html('<i class="fa fa-chevron-right"></i>');
    
    0 讨论(0)
  • 2020-12-02 21:19

    If you using latest Owl Carousel 2 version. You can replace the Navigation text by fontawesome icon. Code is below.

    $('.your-class').owlCarousel({
            loop: true,
            items: 1, // Select Item Number
            autoplay:true,
            dots: false,
            nav: true,
            navText: ["<i class='fa fa-long-arrow-left'></i>","<i class='fa fa-long-arrow-right'></i>"],
    
        });
    
    0 讨论(0)
  • 2020-12-02 21:20

    Complete tutorial here

    Demo link

    JavaScript

    $('.owl-carousel').owlCarousel({
        margin: 10,
        nav: true,
        navText:["<div class='nav-btn prev-slide'></div>","<div class='nav-btn next-slide'></div>"],
        responsive: {
            0: {
                items: 1
            },
            600: {
                items: 3
            },
            1000: {
                items: 5
            }
        }
    });
    

    CSS Style for navigation

    .owl-carousel .nav-btn{
      height: 47px;
      position: absolute;
      width: 26px;
      cursor: pointer;
      top: 100px !important;
    }
    
    .owl-carousel .owl-prev.disabled,
    .owl-carousel .owl-next.disabled{
    pointer-events: none;
    opacity: 0.2;
    }
    
    .owl-carousel .prev-slide{
      background: url(nav-icon.png) no-repeat scroll 0 0;
      left: -33px;
    }
    .owl-carousel .next-slide{
      background: url(nav-icon.png) no-repeat scroll -24px 0px;
      right: -33px;
    }
    .owl-carousel .prev-slide:hover{
     background-position: 0px -53px;
    }
    .owl-carousel .next-slide:hover{
    background-position: -24px -53px;
    }   
    
    0 讨论(0)
  • 2020-12-02 21:28

    A note for others who may be using Owl Carousel v 1.3.2:

    You can replace the navigation text in the settings where you're enabling the navigation.

    navigation:true,
    navigationText: [
       "<i class='fa fa-chevron-left'></i>",
       "<i class='fa fa-chevron-right'></i>"
    ]
    
    0 讨论(0)
提交回复
热议问题