'Bootstrap carousel moving to top when clicking next and before buttons?

Now I have this carousel I made with Bootstrap code:

  <div id="carouselExample" class="carousel slide d-none d-sm-none d-md-block" data-ride="carousel">
             <div class="carousel-inner">
                 <div class="carousel-item active">
                     <div class="row logo justify-content-center">
                         <div class="col">
                            <img class="image-logo" src="img/..." alt=""/>
                         </div>
                         <div class="col">
                            <img class="image-logo" src="img/..." alt=""/>
                         </div>
                     </div>
                 </div>
                 <div class="carousel-item">
                   <div class="row logo justify-content-center">
                       <div class="col">
                          <img class="image-logo" src="img/..." alt=""/>
                       </div>
                       <div class="col">
                          <img class="image-logo" src="img/..." alt=""/>
                       </div>
                   </div>
                 </div>
             </div>
             <a class="carousel-control-prev" href="#carouselExample" role="button" data-slide="prev">
                 <span class="carousel-control-prev-icon" aria-hidden="true"></span>
                 <span class="sr-only">Previous</span>
             </a>
             <a class="carousel-control-next" href="#carouselExample" role="button" data-slide="next">
                 <span class="carousel-control-next-icon" aria-hidden="true"></span>
                 <span class="sr-only">Next</span>
             </a>
         </div>

When I press next and prev butttons, the page moves itself to the top of the browser. How can I disable this?

Thanks!



Solution 1:[1]

I have the same problem on my site.

Fix: href="#carouselExample" change to href="/#carouselExample"

Solution 2:[2]

try to remove

href="#carouselExample"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Eugene Isaichenko
Solution 2 mohameddrira