1

I have an issue where leaflet when embedded in Drupal will not allow the user to click on the map as the Y coordinates have a decimal on for some reason. As a quick fix, I am thinking to put the map into full screen mode outside of Drupal. However I would like to place a link/button on the map that points back to my Drupal site. Any suggestions on placing custom buttons on the map?

1 Answer 1

4

You can implement a custom control to easily add a button on your map with something like that:

var myButton = L.control({ position: 'bottomleft' });

myButton.onAdd = function (map) {
    this._div = L.DomUtil.create('div', 'myButton-css-class');
    this._div.innerHTML = '<a href="urlToGoBackToDrupal">Return to Drupal</a>';
    return this._div;
};

myButton.addTo(map);

Etienne

1
  • Ahh, so anything within the innerHTML acts as normal HTML? really useful snippedt of code here :-)
    – Tom
    Commented Sep 30, 2013 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.