J
J
Justin Bieber2016-05-24 13:36:04
css
Justin Bieber, 2016-05-24 13:36:04

Why doesn't OWL Carousel adapt images inside?

d6q4sgu8.jpg

/*BEGIN SLIDER*/
 $(".slider").owlCarousel({
  items : 1,
  stopOnHover: true,
  itemsDesktop:[1199,1],
  itemsDesktopSmall:[979,1],
  itemsTablet :[768,1],
  itemsMobile: [479,1]
});
 /*button carousel*/
 $(".next_button").click(function(){
  $(this).parent().find(".slider").trigger("owl.next");
});
 $(".prev_button").click(function(){
  $(this).parent().find(".slider").trigger("owl.prev");
});
 /*button carousel*/

 /*END SLIDER*/

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nikita Kit, 2016-05-24
@JustinBieber

better use CSS. For adaptability (although I use a bootstrap slider, that’s not the point), I usually connect images via background-image: url(...) , and then set properties for the background that make the slider adaptive. that is, position center, size cover (sometimes contain, judging by the resolution of the pictures) and no-repeat, for accuracy. and then I give the blocks several media queries and throw different widths and heights there for different screens. Works with a bang.

V
Vladislav, 2016-05-26
@vlad00777

Try to style the pictures:
max-width: 100%;
width: auto;
height: auto;
display:block;
And in slider options:
autoHeight: true,
responsiveClass: true,

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question