kswedberg / jquery-carousel-lite

A jQuery carousel plugin based on jCarouselLite by Ganeshji Marwaha
MIT License
177 stars 59 forks source link

Overflow Hidden on Div bug #21

Closed 17100113 closed 11 years ago

17100113 commented 11 years ago

The documentation says that overflow will be set to 'hidden' for the div having the carousel id/class. But that's not the case in this version. It says that when autoCSS is set to 'true', this will be the case:

"div { visibility: visible; overflow: hidden; position: relative; z-index: 2; /* if the vertical option is set to true, the following would be height / width: XXX / calculated: width of the first li * number of visible items */; }"

But in the source code for the version 1.8.1 of jcarousellite(this version), there is a bug where overflow for this DIV is not being set. I've looked for solutions, thought that my own code might be buggy, but then I looked into jcarousellite's source code. And found this:

This is starting from line 131 from the RAW file:

" var prelimCss = { div: {visibility: 'visible', position: 'relative', zIndex: 2, left: '0'}, ul: {margin: '0', padding: '0', position: 'relative', listStyleType: 'none', zIndex: 1}, li: {overflow: o.vertical ? 'hidden' : 'visible', 'float': o.vertical ? 'none' : 'left'} }; "

For the DIV, the properties that are being set are "visibility", "position", "zIndex", and "left". Overflow isn't mentioned here, whereas it should've been "overflow: hidden" if I'm not mistaken...

I edited this to

" var prelimCss = { div: {visibility: 'visible', position: 'relative', zIndex: 2, left: '0', overflow: 'hidden'}, ul: {margin: '0', padding: '0', position: 'relative', listStyleType: 'none', zIndex: 1}, li: {overflow: o.vertical ? 'hidden' : 'visible', 'float': o.vertical ? 'none' : 'left'} }; "

and it seems to work now. For the issue I was having. An official fix for this would be much appreciated!

kswedberg commented 11 years ago

Thanks for reporting this. I updated the documentation instead of adding overflow: hidden to prelimCss. I've had a few cases where I wanted the overflow to be visible, and overriding the overflow: hidden was a pain.