CSS-Tricks / AnythingSlider

A jQuery Slider plugin for anything.
http://css-tricks.github.io/AnythingSlider/
GNU Lesser General Public License v3.0
1.15k stars 380 forks source link

Slider height collapses by removing height from container class #647

Open annaf-dev opened 8 years ago

annaf-dev commented 8 years ago

Hi,

I want to have a flexible (responsive) Slider. It works so far, but only if I set the height of the slider container. But then I have space at the bottom of the slider (if I resize the window). By removing the fix height from the slider container the slider itself collapses and begins to flicker...

You can try here: http://codepen.io/DeathAngelDaemon/pen/dMgzoe

Does anyone have an idea what to do? I tried a lot of things I've found in the internet, but nothing works for me. :( So hopefully there is another solution.

Mottie commented 8 years ago

Hi @DeathAngelDaemon!

You can set the expand option to true, and then set an aspectRatio value to calculate the width and height.

Check out the demos on, and look at the source code of, the expand demo page.

annaf-dev commented 8 years ago

Hi Mottie, thanks for the hint, but I also tried that. I updated the pen above (commented out the height for .slider-container class and added the aspectRatio attribute) - now it flickers and the images collapse to a very small size.

Mottie commented 8 years ago

It looks like the problem is due to the outer container size. If you add the following css to the demo:

.slider-container {
   width: 100%;
   height: 374px;
}

everything "appears" to start working; but there are two big problems:

  1. The outer container does not automatically adjust it's height based on the width; you're stuck with a fixed height.
  2. Shrinking the window does resize the content using the aspect ratio, but re-expanding the window leaves the content stuck at its smallest size :disappointed:.

To be honest, the main code for this plugin hasn't been touched in about 2 1/2 years. And looking at the code now, it looks like a huge mess! Sadly, I don't have the time, nor the inclination to rewrite it.

The good news is that there are much better responsive sliders available now, especially if you only want to show images. Please consider switching. Maybe someday I'll have time to rewrite this plugin.

annaf-dev commented 8 years ago

I see you understand my problem. Thanks for your honest answer. I already tried other slider plugins, but none of them seems to fit my claims. I will look around for more alternatives. Thanks for your time. :)