malsup / cycle2

2nd gen cycling
899 stars 236 forks source link

fix rounding errors in responsive carousel #678

Open albell opened 9 years ago

albell commented 9 years ago

Clipping the edge of a crucial slide in a responsive carousel looks really bad. This currently happens way too easily. Two fixes:

1) Browsers (incl Chrome) don't seem to resolve all rounding-related layout issues until load. Listen for that as well as resize.

2) Don't round slide CSS widths up to the nearest integer. This causes the last visible slide in the carousel to overflow the container. All modern browsers have used subpixel rendering for a while now. See column 4 in this chart:

http://cruft.io/posts/percentage-calculations-in-ie/