Add css styling to image used in Javascript -
i have image used in js file (it's used geolocation icon) , add css styling because image large on screen.
<!doctype html> <html> <head> <style> html, body { height: 100%; margin: 0; padding: 0; overflow: hidden; } #map { height: 100%; } </style> </head> <body> <div id="map"></div> <script> var locationicon = 'img/svg/user_location.svg'; // try html5 geolocation. if (navigator.geolocation) { navigator.geolocation.getcurrentposition(function(position) { var pos = { lat: position.coords.latitude, lng: position.coords.longitude }; //centers map current position map.setcenter(pos); //sets icon current position var currentlocation = new google.maps.marker({ position: {lat: position.coords.latitude, lng: position.coords.longitude}, map: map, icon: locationicon }); }, function() { handlelocationerror(true, infowindow, map.getcenter()); }); } else { // browser doesn't support geolocation handlelocationerror(false, infowindow, map.getcenter()); } } </script> </body> </html>
how achieve this? edit: added code show how image displayed
i think looking answered in post. how display image javascript? want image outside of .js file. can add class within function of linked solution create class element. there can select class by
.custom-class { width: 100%; height: 100%; etc... }
Comments
Post a Comment