Using touch-action to enable movement from the last item to the first item in HTML/C

Currently, I am utilizing the touch-action property in my carousel which auto slides without any issues. However, I am facing a problem where when I scroll using touch-action, it stops at the last slide instead of looping back to the first slide. My goal is to make it continuous without stopping at the end.

Below is the HTML code snippet:

<div id="testimonial-slider" class="owl-carousel">
    <div class="testimonial">
        <div class="pic">
            <img src="image/pay.png">
        </div>
        <h3 class="title">Williamson</h3>
        <span class="post">Web Developer</span>
        <p class="description">
            Lorem ipsum dolor sit amet, consectetur adipisicing elit...
        </p>
    </div>
    <div class="testimonial">
        <div class="pic">
            <img src="image/pay.png">
        </div>
        <h3 class="title">Kristina</h3>
        <span class="post">Web Designer</span>
        <p class="description">
            Lorem ipsum dolor sit amet, consectetur adipisicing elit...
        </p>
    </div>
</div>

Here is the CSS section:

.owl-carousel .owl-wrapper:after{content:".";display:block;clear:both;visibility:hidden;line-height:0;height:0}
.owl-carousel{display:none;position:relative;width:100%;touch-action:default;}
.owl-carousel .owl-wrapper{display:none;position:relative;-webkit-transform:translate3d(0,0,0)}
.owl-carousel .owl-wrapper-outer{overflow:hidden;position:relative;width:100%}
.owl-carousel .owl-wrapper-outer.autoHeight{-webkit-transition:height 500ms ease...

Lastly, here is the JavaScript code block:

 $(document).ready(function(){
    $("#testimonial-slider").owlCarousel({
        items:1,
        itemsDesktop:[1000,1],
        itemsDesktopSmall:[979,1],
        itemsTablet:[768,1],
        transitionStyle:"backSlide",
        autoPlay:true
    });
});

Answer №1

If you want to create a looping carousel using Owl Carousel, simply add the loop:true option. For more information, please refer to the documentation:

$(document).ready(function(){
    $("#testimonial-slider").owlCarousel({
        items:1,
        itemsDesktop:[1000,1],
        itemsDesktopSmall:[979,1],
        itemsTablet:[768,1],
        transitionStyle:"backSlide",
        autoplay:true,
        loop:true // for looping ref https://owlcarousel2.github.io/OwlCarousel2/docs/api-options.html
    });
});

Check out this JS Fiddle Preview: https://jsfiddle.net/itsselvam/eaq0978s/

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for retrieving a child component's content children in Angular 2

Having an issue with Angular 2. The Main component displays the menu, and it has a child component called Tabs. This Tabs component dynamically adds Tab components when menu items are clicked in the Main component. Using @ContentChildren in the Tabs comp ...

Having trouble getting CSS3 Keyframes to function properly?

Check out the following code snippet: .startanimation { height: 100px; width: 100px; background: yellow; -webkit-animation: animate 1s infinite; } @-webkit-keyframes animate { 100% { width: 300px; height: 300px; } ...

Comparing HTML5 Drag and Drop to jQuery UI Drag and Drop: What's the Difference

In the ever-evolving world of web development, what is the most effective method for creating a drag and drop builder in 2017? While this question has been posed in the past (as seen here), technology changes rapidly. Is HTML5 still the go-to option, or ha ...

What is the best way to auto-fill input fields with data from a Json file

My goal is to automatically populate HTML form fields based on user selection. I have obtained code for related functions, such as fetching JSON data and creating dropdown lists, from a friend. Here is the link to that code: https://jsfiddle.net/r4zuy7tn/1 ...

The ReCaptcha and AJAX Integration

I am attempting to display the ReCaptcha image using its AJAX API. I have been following the instructions from this documentation and observing the behavior of this demo. Despite my efforts, I am still unable to create a functional fiddle. I have added jsf ...

Vue.js Issue: Image not properly redirected to backend server

Having an issue with my Vue app connecting to the backend using express. When I attempt to include an image in the request, it doesn't reach the backend properly. Strangely though, if I bypass express and connect directly from the Vue app, everything ...

How can I make the row color of a jQuery datatable change when the row is selected?

One of my challenges involves implementing a jquery dataTable (view here) where each row contains a checkbox. I want the row's color to change when the checkbox is checked. This is the approach I attempted: <table id="tabellaOrdinaFarmaci" class=" ...

Resolving the problem of JQXdropdown in PHP

Currently, I am utilizing jqxdropdownlist.js to create a dropdown feature in my PHP project. The main requirement is that upon changing the selection, I need to redirect users to specific pages. However, I encountered an issue with the functionality. Let& ...

Guidelines for incorporating Context API in Material UI

Currently, I am encountering a TypeScript error while attempting to pass a property using the Context API within my components. Specifically, the error message reads: "Property 'value' does not exist on type 'String'" To provide conte ...

What is the best approach to manage various json data specific to each jquery tab?

Within my webpage, I am utilizing three different (jQuery) tabs: Overview Pricing Destination info Each of these tabs houses completely unique sets of data. By specifying a URL in the href attribute, I can trigger an AJAX call to retrieve this data. How ...

Unable to navigate using react-router after logging out without a page refresh

In my logout approach, everything seems to work fine - there are no errors in the console, localHistory is cleared successfully, but for some reason it cannot navigate to the login page without refreshing the current page. const handleLogout = () => { ...

Tips for updating the background color of a dropdown menu in the navigation bar

I am attempting to increase the size of the dropdown menu and change its background color. Currently, I can only modify the color of the links and the surrounding area. .navbar a { width: 125px; text-align: center; ...

Using PHP to submit a form depending on user selection

Currently, I am working on a basic input form page that includes a submit button. The goal is to have the data from the form written into my MySQL database based on the user's selection. For instance, if the user chooses option X, I want the input da ...

The Error message "Property 'data' is not present in Type <void> | AxiosHttpResponse<any>" is indicating that the data property is missing on

When I fetch data for a specific user, I have a promise that I use to setState. Below is the implementation: getUserUsername = (): string => { const { match } = this.props; return match.params.username; }; onFetchUser = () => getUse ...

Is there a method to incorporate scss into a project without requiring a separate stylesheet?

I am currently working on a Gatsby application that utilizes SCSS. My code snippet looks like this: import React from "react"; import styles from "./mosaic.module.scss"; import Tile from '../tile/tile'; const Mosaic = (): JSX.Element => ( ...

Inaccurate Feedback on Maquest Direction Route API

Currently, I am in the process of implementing the MapQuest API Direction Routing function on my website. However, upon submitting a request to the API, it is returning inaccurate routing points between two destinations. Here is the request form that I am ...

Mobile devices seem to be constantly refreshing website images

I have a landing page consisting of multiple sections with images as the background, each section occupying the full screen. In one specific section, the images change every 5 seconds. The website works smoothly on desktop, but I encounter issues on mobil ...

Disable the default hover effect of the ASP.NET menu

How can I disable the default hover effect on my asp.net menu and instead display child items when the parent item is clicked? I am currently using the pre-built asp.net menu feature and populating menu items from a sitemap data source. <div class="sp ...

Is it possible to streamline multiple $.fn. calls using javascript or jQuery?

I recently started using datatables and was advised to include the following code: $.fn.dataTableExt.oStdClasses.sWrapper = 'no-margin last-child'; $.fn.dataTableExt.oStdClasses.sInfo = 'message no-margin'; $.fn.dataTableExt.oStdClasse ...

Tips on using Bootstrap 4 containers within a container-fluid and ensuring text stays within a container at all times

What is the best way to incorporate a Bootstrap 4 container within a container-fluid? how can we ensure that text is always contained within the blue section? ...