[jQuery] jquery - carousel

http://code.google.com/p/jquery-infinite-carousel/

download : http://code.google.com/p/jquery-infini ··· s%2Flist

Add an infinite carousel on your site, the easy way. See a Demo here

Features

  • Really easy way to insert a quality HTML carousel on your site
  • Loop infinitely over items when clicking next or previous button
  • Avoid animation flickering due to multi-clicks on next and previous buttons

Some HTML

<div id="viewport"> 
<ul> 
       
<li>1</li> 
       
<li>2</li> 
       
<li>3</li> 
       
<li>4</li> 
       
<li>5</li> 
</ul> 
</div> 
<a id="previous">Previous</a> 
<a id="next">Next</a> 
 
<!--  
ul/li structure can be replaced by any other html structure as div/div, div/span...  
-->

Some CSS

/* Comments on styles purpose in the source code */ 
#viewport{ 
        width
: 240px; 
        overflow
:hidden; 
} 
#viewport ul{ 
        position
: relative; 
        padding
: 0; 
} 
#viewport li{ 
        width
: 100px; 
        height
: 50px; 
       
float: left; 
        list
-style: none; 
}

Some JavaScript : the magic

$('#viewport').carousel('#previous', '#next');

Tips

If you need to activate auto-scrolling on your carousel, simply simulate a click :

//The auto-scrolling function 
function slide(){ 
  $
('#simpleNext').click(); 
} 
//Launch the scroll every 2 seconds 
var intervalId = window.setInterval(slide, 2000); 
 
//On user click deactivate auto-scrolling 
$
('#previous, #simpleNext').click( 
 
function(event){ 
 
if(event.originalEvent){ 
   window
.clearInterval(intervalId); 
 
} 
 
} 
);





크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)

Posted by 홍반장

2011/05/10 13:11 2011/05/10 13:11
,
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/6150

Trackback URL : http://tcbs17.cafe24.com/tc/trackback/6150

« Previous : 1 : ... 14 : 15 : 16 : 17 : 18 : 19 : 20 : 21 : 22 : ... 324 : Next »

블로그 이미지

- 홍반장

Archives

Recent Trackbacks

Calendar

«   2024/11   »
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Statistics Graph

Site Stats

Total hits:
244060
Today:
411
Yesterday:
776