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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -