hooper icon indicating copy to clipboard operation
hooper copied to clipboard

add support for items auto height

Open AndreyFedarovich opened this issue 5 years ago • 4 comments

hooper should be able to adjust according to the height of the contents Example: https://owlcarousel2.github.io/OwlCarousel2/demos/autoheight.html

AndreyFedarovich avatar Sep 24 '19 12:09 AndreyFedarovich

I would like to support this request. Also need such a function.

StanZhuravlev avatar Nov 20 '19 04:11 StanZhuravlev

Just add .hooper{ height:auto !important; } to your css and it should size appropriately

iainwoodou avatar Feb 05 '20 11:02 iainwoodou

Just add .hooper{ height:auto !important; } to your css and it should size appropriately

in this case the wrong width is calculated for the items

Leolik avatar May 17 '20 15:05 Leolik

So I have a temporary solution, but it's not pretty! :( Btw I've had problems with this on several ocasions, it's insane that it's not in the otherwise amazing plugin..

So you can use the slide hooper event like this:

HTML: <hooper @slide="onSlide"></hooper>

CSS:

.hooper-list {
  max-height: 300px; // use a max-width that wouldn't be exceeded.
  transition: all 0.1s; // use preferred transition time
}

JS:

methods: {
  onSlide(payload) {
      const hooperList = document.querySelector(".promotions-wrap .hooper-list");
      setTimeout(function() { // use setTimeout otherwise you get value for previous slide for some reason..
        const hooperHeight = document.querySelector(".promotions-wrap .hooper-slide.is-active.is-current").clientHeight;
        hooperList.style.maxHeight = hooperHeight + "px";
      }, 100);
    }
}

nikolayandreev avatar Jul 30 '20 15:07 nikolayandreev