带有RichMarker的Gmap3

时间:2014-04-11 06:53:37

标签: google-maps-api-3 google-maps-markers jquery-gmap3

我正在尝试使用RichMarker替换图标,如下所示:https://google-maps-utility-library-v3.googlecode.com/svn/trunk/richmarker/examples/richmarker.html

以下是我正在使用的代码:

marker: {
        values: [
            {foreach $items as $item}
                {
                    latLng: [{ifset $item->optionsDir['gpsLatitude']}{!$item->optionsDir['gpsLatitude']}{else}0{/ifset},{ifset $item->optionsDir['gpsLongitude']}{!$item->optionsDir['gpsLongitude']}{else}0{/ifset}],
                    content: "<div class='cluster-bg'><div class='cluster'><span>1</span></div></div>",
                    data: '<div class="marker-holder"><div class="marker-content{ifset $item->thumbnailDir} with-image"><img src="{thumbnailResize $item->thumbnailDir, w => 120, h => 160}" alt="">{else}">{/ifset}<div class="map-item-info"><div class="title">'+{ifset $item->post_title}{$item->post_title}+{/ifset}'</div>{if $item->rating}<div class="rating">{for $i=1; $i <= $item->rating["max"]; $i++}<div class="star{if $i <= $item->rating["val"]} active{/if}"></div>{/for}</div>{/if}<div class="address">'+{ifset $item->optionsDir["address"]}{$item->optionsDir["address"]|nl2br}+{/ifset}'</div><a href="{!$item->link}" class="more-button">' + {__ 'VIEW MORE'} + '</a></div><div class="arrow"></div><div class="close"></div></div></div></div>'
                }
            {if !($iterator->last)},{/if}
            {/foreach}
        ],

我理解如何为单个标记添加丰富的标记,但在这里我是在“值”下动态创建标记。我不知道在哪里添加:

= new RichMarker ({

这两个插件是否可以实现,还是应该在其他地方寻找?

由于

1 个答案:

答案 0 :(得分:0)

以下是您必须添加的代码:

jQuery("YOUR_SELECT").gmap3({
    defaults:{
        classes:{
            Marker:RichMarker
        }
    },
    map:{
        options: {
            zoom: 11,

    },
    marker: {
        options: {
            content: '<div>ADD your Custom HTML code</div>',
        }
    }
})