Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Please help me add a marker to my gmaps script

Featured Replies

<script type="text/javascript">
    $(document).ready(function(){
		new GMaps({
		el: '#map1',
		lat: 51.74673,
		lng: -0.26595,
	});
});
</script>

From reading the docs, it doesn't really show me how to incorporate a marker into my script: http://hpneo.github.io/gmaps/examples/markers.html

 

I feel this is a little bit over my head... Could somebody please help :)

 

(I just want a normal marker with "company name")

 

Thankyou

Edited by Benn_Kingy

There's a bit of code on that page which will put the marked in for you:

map.addMarker({
  lat: -12.043333,
  lng: -77.028333,
  title: 'Lima',
  click: function(e) {
    alert('You clicked in this marker');
  }
});

Just change the co-ordinates where you want the marker. Not tried it myself, but that looks like your answer!

 

Let me know how it goes :)

  • Author

There's a bit of code on that page which will put the marked in for you:

map.addMarker({
  lat: -12.043333,
  lng: -77.028333,
  title: 'Lima',
  click: function(e) {
    alert('You clicked in this marker');
  }
});

Just change the co-ordinates where you want the marker. Not tried it myself, but that looks like your answer!

 

Let me know how it goes :)

 

where/how does that go in my script though?! thats what i got stuck on thankyou

Edited by Benn_Kingy

 

where/how does that go in my script though?! thats what i got stuck on thankyou

 

Give this a go:

<script type="text/javascript">
    $(document).ready(function(){

	new GMaps({
		el: '#map1',
		lat: 51.74673,
		lng: -0.26595,
	});

        map.addMarker({
            lat: -12.043333,
            lng: -77.028333,
            title: 'Lima',
            click: function(e) {
                alert('You clicked in this marker');
            }

        });  
    
    });
</script>

This should work - look at the source code of that page in the header to see how they done it for the demo map, and that'll get you going in the right direction :)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.