Bootstrap Carousel Jumps to top of page when advancing

前端 未结 12 2100
挽巷
挽巷 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:45

    When you link to an HTML anchor, it will be relative to where the

    is, which by default with Twitter Bootstrap, is located at the top of the carousel. I see that your using the data- tags, therefore I don't believe there is a need for the href attributes.

    Change this:

     
    
     
    

    to this:

     
    
     
    

    Currently I'm not at the office, so I haven't had time to test it in more than 1 scenario, however, from the looks, it should still work & give you your desired results.

提交回复
热议问题