Javascript 删除“我的页面中的谷歌地图索引”选项卡
我需要删除页面上地图的索引选项卡。 我使用了下面的代码,但是标签通过了地图上的标记和谷歌标志Javascript 删除“我的页面中的谷歌地图索引”选项卡,javascript,google-maps-api-3,Javascript,Google Maps Api 3,我需要删除页面上地图的索引选项卡。 我使用了下面的代码,但是标签通过了地图上的标记和谷歌标志 var map = new google.maps.Map(document.getElementById('map'), mapOptions); //Remove o TAB do mapa google.maps.event.addListener(map, 'tilesloaded', function() { var mapCo
var map = new google.maps.Map(document.getElementById('map'),
mapOptions);
//Remove o TAB do mapa
google.maps.event.addListener(map, 'tilesloaded', function() {
var mapContent = (document.getElementById("map"));
mapContent('a').attr('tabindex',-1);
});
有些人喜欢以瓦西里的答案为基础
google.maps.event.addListener(MAP, "tilesloaded", function(){
[].slice.apply(document.querySelectorAll('#map a')).forEach(function(item) {
item.setAttribute('tabindex','-1');
});
})
我用jQuery实现了这一点 首先,在加载坐标数据后,我向地图的“空闲”事件添加了一个事件侦听器
this.map.addListener('idle', $.proxy(this._removeTabindex, this));
然后在_removeTabindex函数中,我向所有元素添加了tabindex=“-1”和aria hidden=“true”
_removeTabindex: function () {
$('.gm-map').find('*').each(function() {
$(this).attr('tabindex','-1');
$(this).attr('aria-hidden','true');
})
}
它适用于地图和谷歌的标志,但标签运行地图上的标记。标记具有NAP ID,可以访问它们来删除tabindex?@csf我不知道您在问什么。你是在问如何在tabindex中包含地图标记吗?抱歉..我不想浏览地图上绘制的路线的信息窗口标记传递的选项卡。我决定使用directionsDisplay.setOptions({suppressInfoWindows:true});为什么只使用
[].slice.apply(document.queryselectoral('#映射a'))
而不使用document.queryselectoral('#映射a')
?
_removeTabindex: function () {
$('.gm-map').find('*').each(function() {
$(this).attr('tabindex','-1');
$(this).attr('aria-hidden','true');
})
}