Igor-Vladyka / leaflet.browser.print

A leaflet plugin which allows users to print the map directly from the browser
https://igor-vladyka.github.io/leaflet.browser.print/
MIT License
155 stars 76 forks source link

Fixing the custom print button action #103

Closed iamtekson closed 2 years ago

iamtekson commented 3 years ago

Most of the time, in web development, we used to write our CSS code inside the head section and js code on the bottom of the HTML file. When I tried to remove the default icon, it was not removed because my CSS is already loaded and the actual icon coming from the leaflet.browser.print.min.js file, which was linked at the bottom of the HTML file. So it is recommended to write the style through js below the initialization of the library, something like this,

L.control.browserPrint().addTo(map);
$(".print-map").on("click", function () {
  const modeToUse = L.control.browserPrint.mode.landscape();
  map.printControl.print(modeToUse);
});

$(".leaflet-control-browser-print").css({
  display: "none",
});
Igor-Vladyka commented 2 years ago

It's not quite clean what you are trying to achive with this. In the document example buton is hidden via CSS that can be added to the HEAD of the page, and not with a JS in the bottom. It's a custom case with a custom button.