1

While there are a ton of jQuery carousel plugins out there, I like to roll my own.

Reading through their code I've noticed that people manipulate either scrollLeft or position (left: -100px) in order to "move" the carousel.

Which one is better? Are there any performance benefits from one or the other?


example using scroll: http://jqueryfordesigners.com/jquery-infinite-carousel/

GreenDude
  • 567
  • 2
  • 5
  • 14
  • Good question. I wrote one myself last year and used position, rather than scroll offset and it worked just fine in IE 6 and up. I didn't try it with scrollLeft, though, so offhand I couldn't tell you if there would have been any performance benefits to it. – Scott Jun 17 '11 at 13:40
  • I used scroll until now and all seems fine. It does however slow up in some browsers when I load 100+ items in an infinite carousel :) – GreenDude Jun 17 '11 at 13:43
  • You could also do it by changing margin-left/right of the element. cycle plugin does the same thing and it works fine across all the browsers even will large number of items. – ShankarSangoli Jun 17 '11 at 14:01
  • If you're putting 100+ items in a carousel, I'd wager a bet that a carousel probably isn't the best solution for you! :P – Scott Jun 17 '11 at 14:31

0 Answers0