Bootstrap Carousel Jumps to top of page when advancing

前端 未结 12 2073
挽巷
挽巷 2021-02-15 03:20

When I advance the slider manually, the slider jumps to the top of the page. How can I prevent this from happening? Help much appreciated! Here\'s the code:

<         


        
12条回答
  •  被撕碎了的回忆
    2021-02-15 03:40

    We spent quite a lot of time on this but setting the data-target attribute and other solutions did not work for us. The scroll-up/jumping of the page was happening irrespective.

    This seems to happen with Bootstrap3 carousels where each slide is of different height. @Fabian's comment above helped us. For those who missed it, adding overflow:hidden to the carousel class is a good hack to fix this:

    @media (min-width: 768px)
    {
        #our-carousel
        {
          overflow: hidden;    /* workaround to resolve the page jumping/scrolling up on 
                                  smaller screens on auto/manual advancing of 
                                  carousel */
        }
    }
    

提交回复
热议问题