开发者

Bing Map CSS position:fixed InfoBox issues

开发者 https://www.devze.com 2023-02-18 14:37 出处:网络
I have a map that is position:fixed on my page.So when I scroll down it stays with you on the pageWhen I roll over the pinpoints on my map the InfoBox displays in the correct position, but when I clic

I have a map that is position:fixed on my page. So when I scroll down it stays with you on the page When I roll over the pinpoints on my map the InfoBox displays in the correct position, but when I click one of my results which triggers the Infobox to display it is relative to where the map was when the pa开发者_开发知识库ge loaded (so usually high up on the page and not down where I scrolled it). I am trying to manipulate where the info box displays using the ShowInfoBox, but it always needs LatLong Coordinates instead of pixel coordinates. Since the map moves up and down the page the pixel location could change depending on how far you scroll.

Right now I am just poitioning it with javascript after it loads but that is a less then ideal situation as I run into all sorts of problems.


It's probably a bug with Bing Maps that it doesn't position the infobox correctly. You'll have to work around it. The infobox most likely has a unique ID or a unique class that you could select. Using that you can manipulate the infobox once you set the new Lat/Long position.

When you display the infobox, after you call the show method with the Lat/Long you should then reposition the infobox using CSS based on the scroll positon. So, if the page has scrolled down 100 pixels you need to add 100 pixels to the "top" css property. The same goes for the "left" property. This should always result in your infobox appearing in the correct place.

0

精彩评论

暂无评论...
验证码 换一张
取 消