Created
March 26, 2011 01:01
-
-
Save matellis/887918 to your computer and use it in GitHub Desktop.
Hack to label Google Map controls with known identifiers so you can address specific elements. Requires Jquery.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
controlList = { | |
'map_type_control': 'margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 5px; z-index: 11; position: absolute; cursor: pointer; right: 0px; top: 0px; ', | |
'pan_control': 'cursor: url(https://maps-api-ssl.google.com/intl/en_us/mapfiles/openhand_8_8.cur), default; width: 78px; height: 78px; position: absolute; left: 0px; top: 0px; ', | |
'zoom_control': 'position: absolute; left: 27px; top: 128px; ', | |
'streetmap_control': 'width: 32px; height: 38px; overflow-x: hidden; overflow-y: hidden; position: absolute; left: 0px; top: 0px; ', | |
'hidden_streetmap_control': 'width: 32px; height: 38px; overflow-x: hidden; overflow-y: hidden; position: absolute; left: 0px; top: 0px; visibility: hidden; ', | |
}; | |
function labelControlsWithId() { | |
$.each(controlList, function(id, attr) { | |
ctrls = $('div[style*="' + attr + '"]') | |
if ( ctrls.length == 1 ) { | |
ctrls.attr('id',id); | |
} else { | |
ctrls.each( function(index){ $(this).attr('id', id + "_" + index); }); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tested on Google Maps API v3.4