Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap Carousel - Whole website jumps when image is changing

Hey lovely StackOverflow Community.

I have a problem with my website. I added the Bootstrap Carousel from getbootrap.com and it actually works very well. But there is one problem. Everytime the image sitch, my whole website goes up and down.

I don't know what could be the problem, cause i changed nothing on the code from getbootstrap.com :-/

Sorry for my bad english :D Hope you can understand my problem.

like image 459
DISbeat Avatar asked Dec 24 '22 19:12

DISbeat


2 Answers

Overwrite the Bootstrap class. This will solve your problem

.carousel-inner>.item {
          width: 100%;

}
like image 136
Apurva Ojas Avatar answered Jan 13 '23 10:01

Apurva Ojas


My issue with the Carousel was not directly related to the image, but rather the content within it that was causing the shifting of the page. To avoid it while being elsewhere on the page, I just used JQuery to detect if I had scrolled past my carousel and to make it pause. I know its a workaround but its effective.

$(document).on("scroll",function(){
if($(document).scrollTop()>200){
    $('#slider').carousel('pause');
} else{
    $('#slider').carousel('cycle');
}});
like image 28
Jeff Beagley Avatar answered Jan 13 '23 11:01

Jeff Beagley