Reputation: 2234
I'm making some sprite animation (easter egg) on my site. Its working well on Mozilla. But on Chrome its not working. Problem is everytime I use $("img").attr('src', 'new_path') its downloading new image (not from cache). How I solve it?
Please open it on Mozilla then type "holycow", and you will see how it must work. Then open it on Chrome.
Javascript: http://html5.maniac.mn/js/liukang.js
Upvotes: 0
Views: 463
Reputation: 18833
You're going about this the wrong way, sir. You need to make a sprite sheet and offset the background-position instead. Otherwise you'll get flickering in at least one browser. If you need an example I can update this answer.
Here's a sample of this in action:
hover over the depressed stick figure guy. You can view the js source and any image assets to see how I did it here.
a slightly more elaborate version here: http://www.innercirclestyles.com/
Upvotes: 1