How can I use a sprite to specify the pushpin png

2019-09-05 09:20发布

After (probably) deciding on the jQuery map plugin to use (see What jQuery map plugin allows specifying the color of the pushpins?), I now need png files of colored pushpins.

I found a dandy one here: http://www.fuzzimo.com/free-vector-post-it-notes-push-pins/ :

enter image description here

...but it appears to be, not a collection of various png files I can use (blue.png, red.png, chartreuse.png, etc.) but one humongous .png file with an array of images. So I'm guessing this is meant to be used as a sprite. Being a sprite newby, though, I don't know how to use this image and specify the section of it that I want to use.

Specifically, the jQuery code I'll be using to set the marker's icon is like:

icon: '../img/apartment.png' 

...how can I specify usage of a specific pushpin?

0条回答
登录 后发表回答