How to create a jQuery simple Carousel

This scripts uses the Jcarousellite plugin with some changes to add the pagination.


<style type="text/css">
<!--
body {margin:0; padding:0; background:#fff;}
#slidebox{position:relative; border:1px solid #ccc; margin:40px auto;overflow:hidden;}
#slidebox, #slidebox ul {width:600px;height:300px;}
#slidebox, #slidebox ul li{width:600px;height:300px;}
#slidebox ul li{position:relative; left:0; background:#eee; float:left;list-style: none; padding:15px 28px; font-family:Verdana, Geneva, sans-serif; font-size:13px;}
#slidebox .next, #slidebox .previous{position:absolute; z-index:2; display:block; width:21px; height:21px;top:139px;}
#slidebox .next{right:0; margin-right:10px; background:url(slidebox_next.png) no-repeat left top;}
#slidebox .next:hover{background:url(slidebox_next_hover.png) no-repeat left top;}
#slidebox .previous{margin-left:10px; background:url(slidebox_previous.png) no-repeat left top;}
#slidebox .previous:hover{background:url(slidebox_previous_hover.png) no-repeat left top;}
#slidebox .thumbs{position:absolute; z-index:2; bottom:10px; right:10px;}
#slidebox .thumbs a{display:block; margin-left:5px; float:left; font-family:Verdana, Geneva, sans-serif; font-size:9px; text-decoration:none; padding:2px 4px; background:url(slidebox_thumb.png); color:#fff;}
#slidebox .thumbs a:hover{background:#fff; color:#000;}
#slidebox .thumbs .thumbActive{background:#fff; color:#000; display:block; margin-left:5px; float:left; font-family:Verdana, Geneva, sans-serif; font-size:9px; text-decoration:none; padding:2px 4px;}
-->


<script src="jquery-1.5.2.min.js" type="text/javascript"></script>
<script src="jcarousellite_1.0.1c5.js" type="text/javascript"></script>
<script type="text/javascript">

$(function() {
$("#slidebox").jCarouselLite({
vertical: false,
hoverPause:true,
btnPrev: ".previous",
btnNext: ".next",
visible: 1,
start: 0,
scroll: 1,
circular: true,
auto:1000,
speed:500,
btnGo:
[".1", ".2",
".3", ".4"],

afterEnd: function(a, to, btnGo) {
if(btnGo.length <= to){
to = 0;
}
$(".thumbActive").removeClass("thumbActive");
$(btnGo[to]).addClass("thumbActive");
}
});
});
</script>

<div id="slidebox">
<div class="next"></div>
<div class="previous"></div>
<div class="thumbs">
<a href="#" onclick="" class="1">1</a>
<a href="#" onclick="" class="2 thumbActive">2</a>
<a href="#" onclick="" class="3 ">3</a>
<a href="#" onclick="" class="4">4</a>
</div>
<ul>
<li>content 1</li>
<li>content 2</li>
<li>content 3</li>
<li>content 4</li>
</ul>
</div>
Author: scriptbreaker - Source

Sponsored Links:



Comments

Arun Potti:
2012-08-27 10:08:35

Good Example

Panpic Technology:
2014-07-23 22:07:00

Great work, Thanks for your tutorial

Leave a comment
[Optional]
(Will not be shown on the site)
[Optional]
[Optional]

Recent Comments

sathya ramesh said:

Great post and informative blog.it was awesome to read, thanks for sharing this great content to my vision. Good discussion. ...

Balaji said:

Get the best Automation Anywhere Training in Chennai from Hope Tutors at affordable fees.

Spoken English Classes in Chennai said:

You are an amazing writer. The content is extra-ordinary. Reading your article gives me an inspiration. Thanks for sharing. <a ...

kavi said:

Great post! I am actually getting ready to across this information, It's very helpful for this blog. Also great with all ...

sathya said:

Neat and fruitful presentation!! I thouroughly enjoyed your article. I was searching the post like you wrote. Thanks for ...

kesar price 10 Gm said:

Thanks for Such a Lovely Information

venu said:

Thanks for sharing this amazing article. You are an awesome writer. Waiting for your future posts. https://www.fita.in/ielts-coaching-chennai/ ...

amsaleka said:

Wow!! Really a nice Article. Thank you so much for your efforts. Definitely, it will be helpful for others. I would like to ...

pugal said:

Nice blog. Really very useful....tanq for sharing and keep sharing useful information with us.

Chris Lynn said:

Hi Very Nice Blog I Have Read Your Post It Is Very Informative And Useful Thanks For Posting And Sharing With Us. ...

SyntaxHighlighter.config.stripBrs=true;