Let's say you have a png
and it contains all of the icons
that are to be used on one page, what is the process of using JS to select and display on a certain icon
in that image? I've always seen it being done, but it seems to evade me what it is, and how t开发者_开发百科o do it.
It's done with CSS, not JavaScript, and it's called sprites.
http://css-tricks.com/css-sprites/
You would use CSS and if you want it to be a really painless experience use this website below.
http://www.spritebox.net/
It will take care of generating the picture and also making generating the CSS you will need to output the icons.
Sprites, but you would probably use CSS rather than Javascript.
I guess you are referring to sprite image. js or css can be used to select images.
精彩评论