bxslider-3 icon indicating copy to clipboard operation
bxslider-3 copied to clipboard

fluid height of .bx-window

Open ron78 opened this issue 13 years ago • 5 comments

Hi, I'm wondering if it's possible for the div with the class of bx-window to have fluid height, so that it resizes to the size of each slide, rather than take on the size of the largest slide for everything. Thanks!

ron78 avatar Dec 22 '11 16:12 ron78

You could write something that gets the height of the image/div onAfterSlide and resizes the height to that.

craigmdennis avatar Jan 27 '12 13:01 craigmdennis

This worked for me:

Each div in the slider has an id like slider_0, slider_1, etc.

onAfterSlide: function(currentSlideNumber, totalSlideQty, currentSlideHtmlObject){ $(".bx-window").animate({ height:$("#slider_" + currentSlideNumber).height() },950); }

steveburke avatar Feb 15 '12 16:02 steveburke

You can actually use currentSlideHtmlObject instead. That way you don't have to attach ID's to your slide elements.

onAfterSlide: function(currentSlideNumber, totalSlideQty, currentSlideHtmlObject){

    $(".bx-window").animate({
        height: currentSlideHtmlObject.height()
    }, 250);

}

envex avatar Apr 19 '12 15:04 envex

In the current version of bxslider there is an option called 'adaptiveHeight' that does exactly what you want if set to true (see http://bxslider.com/options#adaptiveHeight).

thomas-tisch avatar Mar 21 '13 14:03 thomas-tisch

i throw now some content inther 2 facebookpost widgets and it doesn´t calculate the height for the content.

webfacer avatar Feb 19 '14 17:02 webfacer