The Owl carousel slide vanishes unexpectedly after resizing the window

My Owl-carousel slides are disappearing after resizing the browser window. You can see the issue in action here: . The website where this problem occurs is: . I suspect it has to do with the CSS animation within the items, as disabling the fade animation resolves the issue. Any assistance in resolving this matter would be greatly appreciated. Thanks.

   <script>
      
  <!-- //Start Hero slider control panel

    var owl = $('.owl-carousel').owlCarousel({
    animateOut: 'fadeOut',
    animateIn: 'fadeIn',
    
    autoplayTimeout: 2000,
    autoplayHoverPause: true,
    loop: true,
    margin: 0,
    nav: false,
    mouseDrag:true,
    touchDrag:true,
    pullDrag:false,
    freeDrag:false,
    dots:false,
    autoplay: true,
    responsive: {
        0: {
            items: 1
        },
        600: {

            items: 1
        },
        1000: {
            items: 1
        }
    }
});
 // End Hero slider control panel
 
// Start Reactivate css animation every time a slide is loaded 

      owl.on('change.owl.carousel', function (event) {
    var el = event.target;
    $('h1', el).addClass('fadeInUp animated')
            .one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
                $('h1', el).removeClass('fadeInUp animated');
            });

             $('.anim1', el).addClass('fadeInUp animated')
            .one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
                $('.anim1', el).removeClass('fadeInUp animated');
            });
        });

  // Start Reactivate css animation every time a slide is loaded 
      </script>
/*Start hero slider*/

.owl-carousel .owl-item {
    -webkit-animation-duration: .7s !important;
    animation-duration: .7s !important;
}

.padding_zero {overflow:hidden; padding:0; margin-top:-35px; border-top:solid 2px #f8f9fa;}


.centered {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width:100%;
}

.fadeInUp {
animation-duration: 1s;
animation-delay: .1s;
}
<!-- Start Hero slider -->
      <div class="container-fluid padding_zero">
        <div class="row justify-content-center ">
          
          <div class="col-12  col-md-12 ">
            
            <div class="owl-carousel owl-theme">
              
              <div class="item " >
                <img src="images/girl2.jpg" alt="" >
                <div class="centered p-3  text-right col-12 item1"><h1 class="fadeInUp mr-2" >Lorem1 ipsum dolor sit..</h1>
                  <p class="fadeInUp anim1 mr-2">Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
                   <a href="index.php" class="btn btn-default  d-md-inline-block px-3 pt-1 mr-2 fadeInUp anim1"  ><b>START PROIECT  </b> <i class="fas fa-caret-right fa-lg "></i></a>
                </div>
              </div>

              <div class="item  ">
                <img  src="images/office2.jpeg" alt="" >
                <div class="centered p-3  text-black text-center col-12 col-md-6 item2"><h1>Lorem2 ipsum dolor.</h1>
                  <p class="anim1">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Molestias alias assumenda impedit cumque beatae quas earum soluta omnis.</p>
                  <a href="index.php" class="btn btn-default px-3 pt-1 anim1 d-md-inline-block "><b>CONTACT</b></a>
                </div>
              </div>

               <div class="item  ">
                <img  src="images/forest1.jpg" alt="" >
                <div class="centered p-3 text-white text-center col-12 col-md-6 item3"><h1>Lorem3 ipsum dolor.</h1>
                  <p class="anim1">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Tempora obcaecati, recusandae porro.</p>
                  <a href="index.php" class="btn btn-default px-3 pt-1 d-md-inline-block anim1"><b>DETALII</b></a>
                </div>
              </div>
            </div>
            
          </div>
        </div>
      </div>
    </section>

<!-- End Hero Slider -->

Answer №1

All the owl carousel files have been thoroughly checked and found to be in good condition. After some investigation, I was able to pinpoint and resolve the issue. It turns out that the CSS animation reactivation code was causing the problem, although the exact reason remains unclear to me. Nevertheless, I have replaced it with a new code snippet, which now looks like this:

 <script>
//Initializing Hero slider
$(document).ready(function(){
var heroSlider = $('.owl-carousel');
heroSlider.owlCarousel({
animateOut: 'fadeOut',
animateIn: 'fadeIn',
autoplayTimeout:3000,
autoplayHoverPause: true,
loop: true,
margin: 0,
nav: false,
mouseDrag:true,
touchDrag:true,
pullDrag:false,
freeDrag:true,
dots:true,
autoplay:true,
responsive: {
0: {
items: 1
},
600: {
items: 1
},
1000: {
items: 1
}
}
});
//Reactivate css animation on slide load
heroSlider.on("changed.owl.carousel", function(event){
var item = event.item.index-2;
$('h1, p').removeClass('fadeInUp');
$('.owl-item').not('.cloned').eq(item).find('h1, p').addClass(' fadeInUp');
$('.anim1').removeClass('fadeInUp');
$('.owl-item').not('.cloned').eq(item).find('.anim1').addClass(' fadeInUp');
})
});
</script>

Everything is functioning properly now. You can view the slider here:

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

Exploring the world of animation with Jquery and images

I'm delving into the world of jQuery to create some captivating animations. Currently, I've been tasked with an assignment involving images that expand, contract, change opacity, and eventually hide. Below is my code snippet: function play_pic1 ...

Adjust the height of a division dynamically

I have the following HTML snippet: <div id="container"> <div id="feedbackBox"></div> </div> The #feedbackBox div is initially not visible. To center the div, the CSS code is used: #container { position: absolute; widt ...

Generate table rows by automatically summing the rows and column data using a loop

I'm currently working on a form that dynamically adds data to columns and rows. While I've successfully generated the column names based on database data and used a loop to add details, adding rows has proved to be quite challenging :) Is ther ...

What causes Firefox's CPU to spike to 100% when a slideshow begins that adjusts the width and left coordinates of certain divs?

Seeking Advice I'm in need of some help with identifying whether the code I'm working on is causing high CPU usage in Firefox or if it's a bug inherent to the browser itself. The situation is getting frustrating, and I've run out of so ...

Creative CSS spinners design

Seeking assistance to modify my spinner design. I want one end to be thicker and the other end to be thin. My attempts so far have been unsuccessful. <div id="data-loader"> <div class="loader"> <div class="blue"></div& ...

Unable to pinpoint the source of the excess spacing within a form field

There appears to be some extra space in the text field of my form, extending beyond the container margin. Please refer to the image and JSFiddle http://jsfiddle.net/GRFX4/. Any thoughts on what might be causing this issue? Thank you. HTML: <div id="co ...

Eliminate duplicate entries in typeahead.js by ensuring unique data sources for both prefetch and remote

Currently, I have implemented typeahead.js with both prefetch and remote data sources. You can check out the example here. $(document).ready(function() { var castDirectors = new Bloodhound({ datumTokenizer: Bloodhound.tokenizers.obj.whitespace('val ...

Utilize the "display: flex" property to position an avatar alongside a comment that is wrapped

Looking for a solution similar to the problem presented in this Stack Overflow thread about positioning text next to an image, but specifically when using "display: flex". We are facing an issue where a comment, consisting of an avatar image and accompany ...

Utilizing jQuery to display only one element from a given pair

Managing a set of message elements that come in pairs and should show or hide opposite each other can be quite tedious. While I have managed to make it work with jQuery, the code seems to be quite verbose: if (conditionA) { $("#a1").show(); $("#a2 ...

Ways to fill ng-style with a CSS object

Creating a dynamic form to manipulate CSS properties in real time has been my latest project. I've managed to define the CSS property names and values within an object, but now I'm struggling to style the item elegantly on the page as the user in ...

The button effortlessly transforms into a sleek email submission form

I have a button that is already styled with basic CSS properties for active and hover states. I would like to add functionality so that when the "Join the Loop" button is clicked, it transforms into a simple email form similar to the one found at Apologie ...

Incorporate highcharts data into your Laravel project using the power of AJAX

Encountering an issue with loading data for a Highcharts chart. The response from my controller provides the following data: [['Doctorado', 91.86],['Maestría', 6.98],['Licenciatura', 1.16]] Although the AJAX call is succes ...

When I submit the page, the textbox is cleared, ensuring the privacy of the masked

I have encountered a couple of issues with this: 1) The phone number format that I am using appears like this: $('#phone').mask('(999) 999-9999'); When submitting the form, I want to validate if the user has entered all 10 numbers. I ...

Add a new string to a class within a Vue.js component

Hey there, currently working on a Vue component where I am iterating through a list of countries. Here's how it looks: <div v-for="i in countries" :key="i.id"> {{i.name}} <span class="flag-icon-gr"></span> I want to dynamically ...

Show concealed content for individuals who do not have javascript enabled

One of the challenges I faced was creating a form with a hidden div section that only appears when a specific element is selected from a list. To achieve this, I utilized CSS to set the display property of the div to 'none' and then used jQuery t ...

Adjusting text alignment to span the entire width with consistent automatic spacing

Imagine if I have a collection of N words. To illustrate, consider the following: Dog Peanut Oranges Lemon Disciplinary All these words vary in length. Let's assume there is a container with a variable width X (the container may adjust its size ac ...

The navigation bar text spills over the designated area

I'm facing an issue in the front end where the navbar does not adjust on narrow screens, causing text to overflow. Although it works fine on wide monitors and mobile screens, iPads in portrait view have the last section of the navbar extend outside of ...

JavaScript validation for radio buttons that are grouped together

Need help with a JavaScript validation issue regarding grouped radio buttons named optionRadios1 to 5. I'm trying to validate them before submitting the form, but my code isn't working as expected and still allows the form submission. Below is t ...

Reverse the order of jQuery toggle animations

Looking for something specific: How can I create a button that triggers a script and then, when the script is done, reverses the action (toggles)? (I am currently learning javascript/jquery, so I am a beginner in this field) Here's an example: ...

Ways to modify the default text in a dropdown menu?

I'm currently attempting to modify the title of a dropdown using the Multi-select plugin found here. However, I've encountered an issue where I am unable to dynamically change the text (Dropdown title) of the dropdown using JavaScript. $(' ...