最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How do I add a class to a pushpin in Bing Maps 7? - Stack Overflow

programmeradmin0浏览0评论

I have a map with a bunch of pushpins and when a mouse goes over the clickable pushpins I want the cursor to change to a pointer instead of a hand. I know how to do this with CSS but none of the Pushpin elements appear to have a class defined. Does anyone know how to set the class for the pushpins? Here is what my Javascript looks like right now.

var pushpin = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(latitude, longitude), { icon: iconUrl, width: size, height: size });
map.entities.push(pushpin);

I have a map with a bunch of pushpins and when a mouse goes over the clickable pushpins I want the cursor to change to a pointer instead of a hand. I know how to do this with CSS but none of the Pushpin elements appear to have a class defined. Does anyone know how to set the class for the pushpins? Here is what my Javascript looks like right now.

var pushpin = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(latitude, longitude), { icon: iconUrl, width: size, height: size });
map.entities.push(pushpin);
Share Improve this question asked Jul 19, 2011 at 20:38 Paul MendozaPaul Mendoza 5,79812 gold badges56 silver badges85 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

By using the Pushpin option "typeName" you can apply a style like so:

JavaScript:

var pushpin = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(latitude, longitude), { icon: iconUrl, width: size, height: size , typeName: 'mypin'});<br/>

map.entities.push(pushpin);

CSS:

.mypin { cursor: pointer !important; };
发布评论

评论列表(0)

  1. 暂无评论