Simple Content Slider using jQuery
I started with the HTML Markup, starting with two ULs. One holds the pagination and the other, content for the slides.
Starting with this HTML Markup, I moved on to the CSS and positioned the layout elements.
HTML
<ul class="content-pagination">
[*][url=0]</a>
[*][url=1][/url]
[*][url=2][/url]
[*][url=3][/url]
[*]<a href="4">[/url]
</ul>
<ul class="content-slides">
[*]
[img]slides/background1.png[/img]
<div class="desc">
<h3>Heading 1</h3>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s!.
</div>
[*]
[img]slides/background2.png[/img]
<div class="desc">
<h3>Heading 2</h3>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s!.
</div>
[*]
[img]slides/background3.png[/img]
<div class="desc">
<h3>Heading 3</h3>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s!.
</div>
[*]
[img]slides/background4.png[/img]
<div class="desc">
<h3>Heading 4</h3>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s!.
</div>
[*]
[img]slides/background5.png[/img]
<div class="desc">
<h3>Heading 5</h3>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s!.
</div>
</ul>I had somewhat a hard time fixing the issues caused by our ancient Internet Explorer 7 and slightly modern Internet Explorer 8 browsers, so I had to meddle with their proprietary form of hacking and fixed them! The final CSS came this way:CSS
.slider {padding: 0; height: 150px; position: relative; overflow: hidden;}
.slider .content-slides {position: absolute; top: 0; left: 0;}
.slider .content-slides li {width: 270px; height: 150px; position: relative; float: left;}
.slider .content-slides li img {width: 270px; height: 150px; display: block;}
.slider .content-slides li .desc {position: absolute; font-size: 90%; background: #999; background: rgba(0, 0, 0, 0.5); left: 0; top: 0; width: 100%; overflow: hidden; padding: 0 0 5px;}
.slider .content-slides li .desc * {color: #fff; width: 200px; margin: 5px 10px; line-height: 1.1em;}
.slider .content-pagination {text-align: right; position: absolute; bottom: 10px; right: 10px; z-index: 5;}
.slider .content-pagination li {float: none; display: inline; font-size: 0.75em; padding: 0.25em;}
.slider .content-pagination li a {width: 7px; height: 7px; border-radius: 7px; background-color: #ccc; overflow: hidden; line-height: 10px; font-size: 1px; text-indent: -999em; display: inline-block; *display: inline; *zoom: 1;}
.slider .content-pagination li.active-marker a,
.slider .content-pagination li a:hover {background-color: #08c; color: #fff;}And yeah, the width and height of background images are fixed and they were 270px × 150px.Now comes the really interesting part, which took me about an hour! The JavaScript rocks in consuming time like anything! 😀 I have to admit that I took a kind of low quality approach in my JavaScript, as I was concerned only about this 5 Content always with pagination and not scalable in future kind of a slider.