滚动标签标记 [英] Label Markers on rollover

查看:135
本文介绍了滚动标签标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

新品牌在这里.....不要伤害我:)。如果我的术语不正确,我也很抱歉。
我没有 HTML 经验,但是通过 FileMaker 来到这里。我正在为我自己的小企业开发FileMaker数据库,并且遇到了我添加到数据库中的 Geocoding 。一切正常。但我试图弄清楚HTML中的哪些地方可以改变参数,所以当我滚动标记时,我可以看到 客户名称 ,而不仅仅是标记1 。当我点击标记名称地址 City State 等全部弹出,但似乎无法弄清楚 标记(标签?)部分。如果这太难问了,我表示歉意,请你指点一下正确的方向。



我一直在这个网站以及其他一些网站上在过去的一周里,只是阅读&尽力学习我所能做的和修补,但仍然难住。

任何帮助/方向都将不胜感激。当然,如果您需要更多信息,请询问。



感谢
Steve



PS请注意下面的 HTML 不是我创建的,只是导入到我的 DB 解决方案中。

 <!DOCTYPE html> 
< html>
< head>
< meta name =viewportcontent =initial-scale = 1.0,user-scalable = no/>
< meta http-equiv =content-typecontent =text / html; charset = UTF-8/>
< title> Google地图测试< /标题>
< style type =text / css>
html,body {
height:100%;
保证金:0;
padding:0;
}

#map_canvas {
height:100%;
}
< / style>
< script type =text / javascriptsrc =http://maps.googleapis.com/maps/api/js?sensor = false>< / script>
< script type =text / javascript>
函数initialize(){
var myOptions = {
zoom:5,
center:new google.maps.LatLng(46.52863469527167,2.43896484375),
mapTypeId:google .maps.MapTypeId.ROADMAP,
mapTypeControlOptions:{
mapTypeIds:[google.maps.MapTypeId.ROADMAP,google.maps.MapTypeId.HYBRID]
}
};

var map = new google.maps.Map(document.getElementById(map_canvas),myOptions);

var markerBounds = new google.maps.LatLngBounds();
var markers = new Array(
[[MarkersArray]]
);

var infoWindow = new google.maps.InfoWindow;

函数addMarker(options){
var marker = new google.maps.Marker({map:map});
marker.setOptions(options);

google.maps.event.addDomListener(marker,'click',function(){
infoWindow.setContent(marker ['info']);

infoWindow.open(map,marker);
});

markerBounds.extend(options.position);

返回标记;

$ b $ google.maps.event.addListener(map,'click',function(){
infoWindow.close();
});

var end = markers.length;
for(var i = 0; i addMarker({
position:markers [i] ['position'],
title:Marker + i,
info:markers [i] ['info']
});
}

map.setCenter(markerBounds.getCenter());
map.fitBounds(markerBounds);
}
< / script>
< / head>
< body onload =initialize()>
< div id =map_canvas>< / div>
< / body>

< / html>


解决方案

标记的标题在鼠标悬停。这是由此代码设置:

  addMarker({
position:markers [i] ['position'] ,
title:Marker+ i,
info:markers [i] ['info']
});

更改标记+ i为您要显示的文本。


brand new here.....don't hurt me :). I also apologize if my terminology is incorrect. I have no HTML experience but come here via FileMaker. I'm working on a FileMaker database just for my own small business and came across Geocoding, which I added to my database. Everything works fine. But I'm trying to figure out where in the HTML I could change the parameters so when I roll over a marker I can see the Customer's name, and not just "Marker 1". I was able to adjust the document so when I click on the marker, Name, Address, City State, etc. all pop up, but can't seem to figure out the marker (label?) part. If this is too much to ask, I apologize, and could you please just point me in the right direction.

I've been on this site and a few others over the past week, just reading & trying to learn all I can, and tinkering, but still remain stumped.

Any help/direction would be greatly appreciated. Of course if you need any more info just please ask.

Thanks Steve

PS Please note the below HTML is not something I created, just imported to my DB solution.

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps Test</title>
<style type="text/css">
html, body {
   height: 100%;
   margin: 0;
   padding: 0;
}

#map_canvas {
  height: 100%;
}
</style>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?                     sensor=false"></script>
<script type="text/javascript">
    function initialize() {
   var myOptions = {
    zoom: 5,
    center: new google.maps.LatLng(46.52863469527167,2.43896484375),
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    mapTypeControlOptions: {
        mapTypeIds: [google.maps.MapTypeId.ROADMAP,     google.maps.MapTypeId.HYBRID]
    }
};

var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

var markerBounds    = new google.maps.LatLngBounds();
var markers         = new Array(
    [[MarkersArray]]
    );

var infoWindow = new google.maps.InfoWindow;    

function addMarker(options){
    var marker = new google.maps.Marker({map:map});
    marker.setOptions(options);

    google.maps.event.addDomListener(marker, 'click', function() {
        infoWindow.setContent(marker['info']);

        infoWindow.open(map, marker);
    });

    markerBounds.extend(options.position);

    return marker;
}

google.maps.event.addListener(map, 'click', function() {
    infoWindow.close();
});

var end = markers.length;
for(var i=0; i<end; i++) {
    addMarker({
        position: markers[i]['position'],
        title: "Marker "+i,
        info: markers[i]['info']
    });
}

map.setCenter(markerBounds.getCenter());
map.fitBounds(markerBounds);
}
</script>
</head>
<body onload="initialize()">
  <div id="map_canvas"></div>
</body>

</html>

解决方案

The "title" of the marker is what is displayed on mouseover. It is being set by this code:

addMarker({
    position: markers[i]['position'],
    title: "Marker "+i,
    info: markers[i]['info']
});

Change the "Marker "+i to be the text you want displayed.

这篇关于滚动标签标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆