Twitter Bootstrap carousel different height images cause bouncing arrows

后端 未结 14 979
刺人心
刺人心 2020-12-07 16:11

I\'ve been using Bootstrap\'s carousel class and it has been straightforward so far, however one problem I\'ve had is that images of different heights cause the arrows to bo

14条回答
  •  时光取名叫无心
    2020-12-07 16:57

    If you want to have this work with images of any height and without fixing the height, just do this:

    $('#myCarousel').on("slide.bs.carousel", function(){
         $(".carousel-control",this).css('top',($(".active img",this).height()*0.46)+'px');
         $(this).off("slide.bs.carousel");
    });
    

提交回复
热议问题