Making a simple jQuery carousel

被刻印的时光 ゝ 提交于 2019-12-23 05:09:39

问题


I'd like to make a very simple jQuery carousel, that advanced via a set of controls "back" | "forward", and loops infinitely. Seems like all the ready made ones have way more features than I'd like.

The structure I have now looks like this. HTML:

<section id="content">
  <a class="back">Back</a>
  <a class="forward"/>Forward</a>

  <article>
   <p>Lorem ipsum</p>
  </article>

  <article>
   <p>Lorem ipsum</p>
  </article>

  <article>
   <p>Lorem ipsum</p>
  </article>

</section>

The first one in the stack is the default on page load, and I'd like to animate to the left when it goes forward, and to the right when it goes backwards.

Any pointers on what this might look like in jQuery?


回答1:


One (in fact two) of the lessons on 30 days to learn jQuery tutorial is a simple slider implementation that might help you to build your own carousel:

http://tutsplus.com/lesson/the-obligatory-slider/
http://tutsplus.com/lesson/prototypal-inheritance-and-refactoring-the-slider/



来源:https://stackoverflow.com/questions/11075664/making-a-simple-jquery-carousel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!