I guess that using 2d sprites is a good choice as
mastercomputers said, and also this don't mean that all the other code posted here are bad, incorrect or invalid, honestly, i think that the best way to implement this will be a mix of all of them.
A couple of weeks ago i did a couple of experiments in my spare time, one to made an automatic slide show using only one big image for it and using CSS and Javascript, and the other experiment was related with Image Maps using the MAP and IMG HTML tags, some CSS and Javascript code, and aditionally i use the
Google AJAX Language API for some automatic text translation.
For the first experiment i use the following CSS and Javascript code inside the HEAD section:
<style type="text/css">
#divc { background: #000 none height:250px; width:130px;}
#c { background: #000 url('pics/tattoo flash.jpg') no-repeat -10px -20px; height:214px; width:116px;}
</style>
<script type="text/javascript">
// Array of all background-position
var allSlides=["-10px -20px","0px -120px","-50px 0px"];
var myTime = 5; // number of seconds
var thisAd = 0; // current slide
var imgCt = allSlides.length; // number of slides
function rotate() {
if (document.images) {
thisAd++;
if (thisAd == imgCt) {
thisAd = 0;
}
document.getElementById("c").style.backgroundPosition=allSlides[thisAd];
setTimeout("rotate()", myTime * 1000);
}
}
</script>
And under the BODY section i use the following HTML code:
<body onload="rotate()">
<!-- other stuff -->
<div id="divc">
<h2 id="c">H2 Heading</h2>
</div>
<!-- other stuff -->
</body>
Because it is an automatic slide show i use the onload event of the body to start the slide show everytime the page loads and two block elements, a DIV to act as a container and a H2 which acts as the slide show itself. BTW, it is not finished or perfect IT IS AN EXPERIMENT and can be viewed live at
An Automatic Slide Show Using CSS and Javascript.
Now, the second one is no longer an experiment anymore, please view it live at
Casa Blanca Tatoo and look at the source code to get a complete idea of how it works.
Basically, what i did here is to use a single image that will be used by a MAP tag with four AREA tags defined as rect -rectangular- and four DIVs tags for the translated texts. For each AREA tag defined i set it's onmouseover and onmouseout events to shows up the correct translated text when you hovers your mouse over any of the flags or over the ENTER text which all are part of the single image used by the MAP. clear???
Best regards,