Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
753 views
in Technique[技术] by (71.8m points)

javascript - Remove the tabindex the google maps in my page

I need to remove the tabindex the map on my page. I used the code below but the tab passes through the markers on the map and the Google logo.

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);          
      });
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Building off Vasil's answer

google.maps.event.addListener(MAP, "tilesloaded", function(){
    [].slice.apply(document.querySelectorAll('#map a')).forEach(function(item) {
        item.setAttribute('tabindex','-1');
    });
})

Here is it in action.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.8k users

...