Testing a sprite sheet on a small web page I created. The code for each sprite in sprites.css
is structured like this...
.a320_0 {
top: 0px;
left: 0px;
width: 60px;
height: 64px;
background: url("images/sprites.png") no-repeat -787px -398px;
}
The layout of my test page is as follows...
var i = 0
function imageChange() {
setTimeout(function() {
var hdg = i * 15;
document.getElementById('image').className = "a320_" + hdg;
i++;
if (i < 24) {
imageChange();
}
}, 1000)
}
imageChange()
<div id='imageContainer'>
<div id='image'></div>
</div>
Verified that the class name changes during the loop and matches classes in my style sheet. Both sprites.css
and sprites.png
are located in the images folder within the same directory as my page.
When directly applying a rule from the style sheet to the page with #image
, I can display the specific image, confirming correct sprite coordinates. However, placing the styles into the actual css file or using .className =
does not yield the expected result. Previously functional setup now encountering issues, seeking assistance...