Animate owlCarousel slide motion in reverse when using the Prev and Next buttons

The default functionality of owlCarousel is to move to the right when clicking Next and to the left when clicking Prev. However, after applying animations, both directions always move in the same direction.

Check out this sample on jsfiddle to see the issue: JSFiddle owl animation sample

In the provided fiddle, the slider should slide up when clicking Next and down when clicking Prev, but it only moves up. I have experimented with various animation options from Animate.css without success.

I also attempted to use JQuery and owl carousel triggers to modify the animation when clicking next or prev, but that did not resolve the issue either.

$(".news-slider .owl-nav .owl-next").click(function(e){

    var carousel = caseStudeisContent.data('owl.carousel');
    animateIn = "slideInLeft";
    animateOut = "slideOutRight";

    carousel.settings.animateOut = animateOut;
    carousel.settings.animateOut = animateOut;
    carousel.options.animateIn = animateIn;
    carousel.options.animateIn = animateIn;

    caseStudeisContent.trigger('refresh.owl.carousel');
    console.log("next");
    caseStudeisContent.trigger("next.owl.carousel");
});

$(".news-slider .owl-nav .owl-prev").click(function(e){

    var carousel = caseStudeisContent.data('owl.carousel');
    animateIn = "slideLeft";
    animateOut = "slideInRight";

    carousel.settings.animateOut = animateOut;
    carousel.settings.animateOut = animateOut;
    carousel.options.animateIn = animateIn;
    carousel.options.animateIn = animateIn;

    caseStudeisContent.trigger('refresh.owl.carousel');
    console.log("prev");
    caseStudeisContent.trigger("prev.owl.carousel");
})

https://i.stack.imgur.com/FW4Du.png

Answer №1

It appears that accomplishing this task using Owl Carousel is challenging due to the limitations of the library.
One potential solution in this scenario involves utilizing the transform property.

To address this issue, start by eliminating animateOut: 'fadeOutUp' and animateIn: 'fadeInUp' to return it to a basic slider format. Next, incorporate the transform property for rotating .owl-carousel and .owl-item:


.owl-carousel {
  transform: rotate(90deg);
}
.owl-carousel .owl-item {
  transform: rotate(-90deg) translate(25px); // adjust positioning accordingly
}

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

Strange alignment issues occurring solely on certain PCs

Currently, I am in the process of developing a website for a client who has requested that it be an exact replica of the mockup provided. However, I have encountered some issues with the headers and certain divs that contain background elements. Surprising ...

Utilizing VueJS to transfer information for constructing a pricing plan chart

This is my first experience with VueJS, so I would greatly appreciate any advice or alternative methods to solve the issue. You can view my progress so far here. I am working on creating a pricing plan table where users can explore four different payment ...

Utilizing the closest method to set selection choices within a table's select tag

Currently, I am attempting to populate dynamic options in a select tag that is located within a table. The number of rows in this table can vary based on certain conditions. After retrieving the data via ajax, I am running into issues when trying to set i ...

Steps for embedding a webpage within a div element

I am facing an issue while trying to load a web page within a div using an ajax call. Unfortunately, it's not working as expected and displaying the following error message: jquery.min.js:2 [Deprecation] Synchronous XMLHttpRequest on the main thread ...

Effortless Form Filling using PHP Ajax

There are two text fields on my form: no_id and customer_name. As the user types in no_id, customer_name is automatically populated. Form <form> <input type="text" name="no_id" onkeyup="autofill()" id="no_id"> <input type="text" name=" ...

Customizing Navigation Color on Laravel Websites for Staging and Live Servers

I am seeking a solution to change the color of the Laravel navigation bar depending on whether it is the live or staging server. Our current setup involves testing code on a staging server before pushing it to the live server in production via Bitbucket. ...

Verify if the value in a textbox exceeds the number entered in an array of textboxes

My goal is to compare the value of a single text box, labeled as "totalmarkstoall", with multiple arrays of text boxes labeled as "marksscored". The JavaScript code below is set up to compare these values using a key up function. The issue I am facing is ...

Personalized CSS styling for Jquery Mobile version 1.3

Having trouble with styling a page in jquery using CSS, specifically aligning #navgroup to the center of the footer and removing an additional white counter from the slider. Here is my code: <!doctype html> <html lang="en> <head> < ...

Transferring a JavaScript variable to a PHP file through jQuery's Ajax functionality

I'm having trouble figuring out how to pass a JavaScript variable to a PHP script using AJAX. This is my first attempt at using AJAX and I seem to be missing something. Here's the code snippet: function selectCategory(value) { $.ajax({ ...

Adjusting the width of a Material UI select/dropdown component

In my material-ui grid setup, each <Grid> contains a <Paper> element to define the grid's boundaries precisely. Inside every <Paper>, there is a custom <DropDown> component (a modified version of Material-UI's Select). I ...

The success callback is not triggered with $.ajax

Does anyone know why this api call only succeeds when an alert is left on the page? <button class="login100-form-btn" onclick="CheckUser();">Entrar</button> function CheckUser() { const result = Auth(); alert(); ...

Transform PHP array into a JavaScript array

Currently, I am using Laravel and retrieving a list of values from a database with the following code: $idordenes = DB::table('ordenes')->select('id')->get(); Upon echoing the idordenes variable, the output is as follows: [{"fa ...

How to dynamically add events to a JQuery FullCalendar using a loop

When utilizing the jQuery full calendar, I need to dynamically set events based on data obtained from a database. To achieve this, I am using data attributes to assign values and then display them on the calendar. Below is an example of my html twig code: ...

Is there a challenge in setting up a tag search bar similar to Stack Overflow's?

First and foremost, I apologize for the awkwardly phrased question. The issue at hand is that when the tags exceed the container size, the search option becomes hidden. My goal is to have the search bar adjust dynamically, moving everything back inside the ...

Is it possible to use WHILE loops twice in PHP?

Just starting out with PHP and hoping for some assistance. I have a MySQL database table with columns for "id", "img", "link", and "desc". My goal is to echo all of this data in the following format: <div id="featured"> <a target='_b ...

What is the best way to replicate touch functionality on mobile browsers for both Android and iPhone devices?

Recently, while developing a web application, I ran into an issue on mobile browsers where the :active pseudo class wasn't functioning properly. I am currently utilizing CSS sprites and looking for guidance on how to simulate clicks for mobile browser ...

Retrieve a specific column value upon button click in HTML and JavaScript

I am faced with a table containing multiple columns, each row equipped with an edit button. Upon clicking the edit button, a modal view pops up where users can input values that are then sent via AJAX to my controller. The challenge I'm encountering ...

I'm having trouble getting my HTML <button> element to function correctly

I'm currently working on a project where I need to animate a green bar moving upward over a blue bar when a button is clicked. However, no matter what I try, the button doesn't seem to be working. I've experimented with using both the button ...

"Efficiently handle online submissions: Use Django to submit a form and instantly display the outcome

I have an urgent task to develop a web page where users can input data, and the backend will perform calculations and display the result below the input field on the same page (similar to checking online air ticket prices). I am new to Django and HTML. Be ...

Implement a Loop that Generates Buttons with Popups Using jQuery Mobile

Within the context of XML parsing, I have utilized this code to generate buttons dynamically using a loop: $('#button' + counter + paramcounter).click(function(){ sendData(escape(parameterarray[cnt2] + $('#textinput' + cnt + cnt2).v ...