Manish Shukla
Manish Shukla

Reputation: 71

OWL carousal adding #slide-0/1/2 on autoplay

I have implemented Owl carousal for one of my project. When page load is complete and carousal on Auto play. Its adding #slide in my URL.

Eg.
www.example.com/home#slide-0  
www.example.com/home#slide-1  
www.example.com/home#slide-2

Is there as any setting I need to disable.

Upvotes: 0

Views: 475

Answers (1)

azs06
azs06

Reputation: 3517

You have URLhashListener set to true, you have to remove it from owl carousel settings object, or set it to false. https://owlcarousel2.github.io/OwlCarousel2/demos/urlhashnav.html

Here is owl carousel with autoplay on.

$('.owl-carousel').owlCarousel({
    loop:true,
    margin:10,
    nav:true,
	autoplay: true,
	autoplayTimeout:1000,
	autoplayHoverPause:true,
    responsive:{
        0:{
            items:1
        },
        600:{
            items:3
        },
        1000:{
            items:5
        }
    }
})
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>Owl Carousel</title>
</head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.2.1/assets/owl.carousel.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.2.1/assets/owl.theme.default.css">	
<body>
<div class="owl-carousel owl-theme">
    <div class="item"><h4>1</h4></div>
    <div class="item"><h4>2</h4></div>
    <div class="item"><h4>3</h4></div>
    <div class="item"><h4>4</h4></div>
    <div class="item"><h4>5</h4></div>
    <div class="item"><h4>6</h4></div>
    <div class="item"><h4>7</h4></div>
    <div class="item"><h4>8</h4></div>
    <div class="item"><h4>9</h4></div>
    <div class="item"><h4>10</h4></div>
    <div class="item"><h4>11</h4></div>
    <div class="item"><h4>12</h4></div>
</div>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.2.1/owl.carousel.js"></script>	
</body>
</html>

Upvotes: 1

Related Questions