Hi guys,
On my sites homepage i'm looking to incorporate a rotating banner.
I have a selection of images (4), which currently change/rotate.
However, what i would really like is to develop something similar to what Oracle have done - http://www.oracle.com/index.html
You can see there banner is made up of 3 parts:
1) The main image in the middle.
2) A header - that displays an icon for each image.
3) A footer which is by default hidden, but slides up upon a selection.
Current code:
HTML:
- <html>
- <head>
- <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
- <link href="rotate.css" rel="stylesheet" type="text/css" />
- <script type="text/javascript" src="main.js"></script>
- <script type="text/javascript">
- $(window).load(function() {
startRotator("#rotator");
})
</script> - </head>
- <body>
- <div id="rotator">
- <img src="images/slideImage1.png" />
- <img src="images/slideImage2.png" />
- <img src="images/slideImage3.png" />
- <img src="images/slideImage4.png" />
- </div>
- </body>
- </html>
jQuery:
- function rotateBanners(elem) {
- var active = $(elem+" img.active");
- var next = active.next();
- if (next.length == 0)
- next = $(elem+" img:first");
- active.removeClass("active").fadeOut(200);
- next.addClass("active").fadeIn(200);
- }
- function prepareRotator(elem) {
- $(elem+" img").fadeOut(0);
- $(elem+" img:first").fadeIn(0).addClass("active");
- }
- function startRotator(elem) {
- prepareRotator(elem);
- setInterval("rotateBanners('"+elem+"')", 2500);
- }
CSS:
- #rotator img {
position: absolute;
}
I am using HTML and jQuery.
Thanks