https://github.com/mariley20/leaflet-logo
Logo Plugin for Leaflet
https://github.com/mariley20/leaflet-logo
Last synced: 29 days ago
JSON representation
Logo Plugin for Leaflet
- Host: GitHub
- URL: https://github.com/mariley20/leaflet-logo
- Owner: Mariley20
- License: mit
- Created: 2020-01-14T19:37:34.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-01-15T19:44:39.000Z (over 6 years ago)
- Last Synced: 2025-12-20T00:19:42.680Z (7 months ago)
- Language: JavaScript
- Size: 12.7 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# leaflet-logo
A useful control to logo with many options for page.
## Basic Usage
### Set up:
1. Get CSS and JavaScript files
2. Include CSS and JavaScript files
3. 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.
```html
```
#### Add the following snippet to your map initialization:
This snippet adds the control to the map. You can pass also pass a configuration.
```js
L.control.logo({
link: 'Redirect Url',
image: 'Image Url'
}).addTo(map);
```
### Possible options
The logo controls inherits options from [Leaflet Controls](http://leafletjs.com/reference.html#control-options).
To customize the control, pass an object with your custom options to the logo control.
```js
L.control.logo(OPTIONS).addTo(map);
```
Possible options are listed in the following table. More details are [in the code](https://github.com/barisariburnu/leaflet-logo/blob/master/src/leaflet-logo.js#L7).
| 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
```js
var lc = L.control.logo({
position: 'topleft',
link: '#',
image: 'https://avatars3.githubusercontent.com/u/7146753?v=3&s=100'
}).addTo(map);
```
## License
MIT