"angular google maps my location button" Code Answer's
You're definitely familiar with the best coding language Javascript that developers use to develop their projects and they get all their queries like "angular google maps my location button" answered properly. Developers are finding an appropriate answer about angular google maps my location button related to the Javascript coding language. By visiting this online portal developers get answers concerning Javascript codes question like angular google maps my location button. Enter your desired code related query in the search bar and get every piece of information about Javascript code related question on angular google maps my location button.
angular google maps my location button
var map,
faisalabad = {lat:31.4181, lng:73.0776};
function addYourLocationButton (map, marker)
{
var controlDiv = document.createElement('div');
var firstChild = document.createElement('button');
firstChild.style.backgroundColor = '#fff';
firstChild.style.border = 'none';
firstChild.style.outline = 'none';
firstChild.style.width = '28px';
firstChild.style.height = '28px';
firstChild.style.borderRadius = '2px';
firstChild.style.boxShadow = '0 1px 4px rgba(0,0,0,0.3)';
firstChild.style.cursor = 'pointer';
firstChild.style.marginRight = '10px';
firstChild.style.padding = '0';
firstChild.title = 'Your Location';
controlDiv.appendChild(firstChild);
var secondChild = document.createElement('div');
secondChild.style.margin = '5px';
secondChild.style.width = '18px';
secondChild.style.height = '18px';
secondChild.style.backgroundImage = 'url(https://maps.gstatic.com/tactile/mylocation/mylocation-sprite-2x.png)';
secondChild.style.backgroundSize = '180px 18px';
secondChild.style.backgroundPosition = '0 0';
secondChild.style.backgroundRepeat = 'no-repeat';
firstChild.appendChild(secondChild);
google.maps.event.addListener(map, 'center_changed', function () {
secondChild.style['background-position'] = '0 0';
});
firstChild.addEventListener('click', function () {
var imgX = 0,
animationInterval = setInterval(function () {
imgX = -imgX - 18 ;
secondChild.style['background-position'] = imgX+'px 0';
}, 500);
if(navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
map.setCenter(latlng);
clearInterval(animationInterval);
secondChild.style['background-position'] = '-144px 0';
});
} else {
clearInterval(animationInterval);
secondChild.style['background-position'] = '0 0';
}
});
controlDiv.index = 1;
map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(controlDiv);
}
map = new google.maps.Map(document.getElementById('map'), {
zoom: 15,
center: faisalabad
});
var myMarker = new google.maps.Marker({
map: map,
animation: google.maps.Animation.DROP,
position: faisalabad
});
addYourLocationButton(map, myMarker);
All those coders who are working on the Javascript based application and are stuck on angular google maps my location button can get a collection of related answers to their query. Programmers need to enter their query on angular google maps my location button related to Javascript code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about angular google maps my location button for the programmers working on Javascript code while coding their module. Coders are also allowed to rectify already present answers of angular google maps my location button while working on the Javascript language code. Developers can add up suggestions if they deem fit any other answer relating to "angular google maps my location button". Visit this developer's friendly online web community, CodeProZone, and get your queries like angular google maps my location button resolved professionally and stay updated to the latest Javascript updates.