sachinchoolur / lightslider

JQuery lightSlider is a lightweight responsive Content slider with carousel thumbnails navigation
http://sachinchoolur.github.io/lightslider/
MIT License
2.04k stars 1.52k forks source link

Problem with height before AJAX is finished, solved? #456

Open cpopolo opened 4 years ago

cpopolo commented 4 years ago

LightSlider has been great - a real lifesaver... One problem I have had is for text or Highcharts content (i.e. not images) that are delivered to the DIV from AJAX, the LightSlider doesn't know the height of the future content so it assigns zero height. I've tried setting up the OnSliderLoad event with a call to height(), and that worked when I only had one slider. When I added a second instance, only one of the sliders would resize to accommodate the AJAX content. I think maybe the onSliderLoad isn't separate for each instance of the Lightslider...

Nonetheless, after much fussing with this problem, I ended up styling the UL with "min-height" set with a value that is guaranteed to fit the AJAX content.

Is there a better way to have the DIV/UL respond to AJAX content correctly?

One other option could be to call LightSlider in the AJAX success, but this is very awkward since several AJAX calls are involved, plus I'd rather have the space allocated for the slider div as soon as possible to avoid jumping boxes as they get filled.

Thanks