0.1.3 • Published 4 years ago
leaflet-logo-plugin v0.1.3
leaflet-logo
A useful control to logo with many options for page.
Basic Usage
Set up:
- Get CSS and JavaScript files
- Include CSS and JavaScript files
- Initialize plugin
Add the JavaScript and CSS files
This example shows how to include the logo control files directly from github. In production, prefer using npm.
<link rel="stylesheet" href="https://github.com/barisariburnu/leaflet-logo/blob/master/dist/leaflet-logo.min.css" />
<script src="https://github.com/barisariburnu/leaflet-logo/blob/master/dist/leaflet-logo.min.js" charset="utf-8"></script>
Add the following snippet to your map initialization:
This snippet adds the control to the map. You can pass also pass a configuration.
L.control.logo({
link: 'Redirect Url',
image: 'Image Url'
}).addTo(map);
Possible options
The logo controls inherits options from Leaflet Controls.
To customize the control, pass an object with your custom options to the logo control.
L.control.logo(OPTIONS).addTo(map);
Possible options are listed in the following table. More details are in the code.
Option | Type | Default |
---|---|---|
position | string | topleft |
height | string | 50px |
width | string | 50px |
target | string | 50px |
link | string | None (required) |
image | string | None (required) |
For example, to customize the position, link and image, you could write
var lc = L.control.logo({
position: 'topleft',
link: '#',
image: 'https://avatars3.githubusercontent.com/u/7146753?v=3&s=100'
}).addTo(map);
License
MIT