使用zIndexOffset将传单自定义标记放在前面

时间:2013-11-23 21:37:40

标签: javascript leaflet

我正在尝试将标记#3放在前面,因此标记#19和#20不会覆盖它。

http://infovisual.dk/xmas/

根据文档,这必须使用zIndexOffset完成,但我尝试了很多不同的方法,似乎没有任何工作:标记#3保持部分隐藏。

任何人都可以给我一些提示吗?

function start_up_biglayers(latitude, longitude, Day) {

var DayMarker = L.Icon.extend({
    options: {
    shadowUrl: './map_files/shadow-marker.png',
    iconSize:     [44, 70], // size of the icon
    shadowSize:   [80, 70], // size of the shadow
    iconAnchor:   [21, 67], // point of the icon which will correspond to marker's location
    shadowAnchor: [24, 68],  // the same for the shadow
    popupAnchor:  [-3, -76] // point from which the popup should open relative to the iconAnchor
        }
    });

var dec_1 = new DayMarker({iconUrl: './map_files/marker_1.png'}),
    dec_2 = new DayMarker({iconUrl: './map_files/marker_2.png'}),
    dec_3 = new DayMarker({iconUrl: './map_files/marker_3.png', ZIndexOffset: 100}),
    dec_24 = new DayMarker({iconUrl: './map_files/marker_24.png'}),
    dayMarker = new DayMarker({iconUrl: './map_files/marker_' + xmas[number].Day + '.png'})

    layer = new L.marker([latitude,longitude], {icon: dayMarker});

1 个答案:

答案 0 :(得分:1)

  1. javascript区分大小写,属性必须以小写字母z
  2. 开头
  3. 您必须为zIndexOffset设置L.Marker,而不是L.Icon