Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added dist/home-solid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions dist/leaflet.zoomhome.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,12 @@ a.leaflet-control-zoomhome-in,
a.leaflet-control-zoomhome-out {
font-size: 1.5em;
line-height: 26px;
}

.zoomhome-img {
margin: auto;
vertical-align: middle;
display: inline-block;
height: 0.95em;
width: 0.95em;
}
3 changes: 2 additions & 1 deletion dist/leaflet.zoomhome.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
zoomOutTitle: 'Zoom out',
zoomHomeIcon: 'home',
zoomHomeTitle: 'Home',
imageSource: null,
homeCoordinates: null,
homeZoom: null
},
Expand All @@ -36,7 +37,7 @@

this._zoomInButton = this._createButton(options.zoomInText, options.zoomInTitle,
controlName + '-in', container, this._zoomIn.bind(this));
var zoomHomeText = '<i class="fa fa-' + options.zoomHomeIcon + '" style="line-height:1.65;"></i>';
var zoomHomeText = '<img class="zoomhome-img" alt="icon of a house" src=' + options.imageSource + '/>';
this._zoomHomeButton = this._createButton(zoomHomeText, options.zoomHomeTitle,
controlName + '-home', container, this._zoomHome.bind(this));
this._zoomOutButton = this._createButton(options.zoomOutText, options.zoomOutTitle,
Expand Down
2 changes: 1 addition & 1 deletion dist/leaflet.zoomhome.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 12 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
<html>
<head>
<meta charset="utf-8">
<title>leaflet.zoomhome demo</title>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"/>
<title>leaflet.zoomhome demo - no font awesome</title>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
<link rel="stylesheet" href="dist/leaflet.zoomhome.css"/>
<style>
html, body, #map {
Expand All @@ -26,6 +25,7 @@
border-radius: 6px;
color: #555;
width: 22em;
z-index: 1500;
}

#legend p {
Expand All @@ -37,8 +37,11 @@
font-size: 120%;
}
</style>
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<script
src="https://code.jquery.com/jquery-3.6.0.slim.min.js"
integrity="sha256-u7e5khyithlIdTpu22PHhENmPcRdFiHRjhAuHcs05RI="
crossorigin="anonymous"></script>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<script src="dist/leaflet.zoomhome.min.js"></script>
</head>
<body>
Expand All @@ -50,20 +53,20 @@ <h1>leaflet.zoomhome demo</h1>
home button to reset the view.</p>
</div>
<script>
var TILES_URL = 'https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png',
const TILES_URL = 'https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png',
INITIAL_LOCATION = [49.0140679, 8.4044366],
INITIAL_ZOOM = 13,
ATTRIBUTION = 'Map data &copy; <a href="https://openstreetmap.org">OpenStreetMap</a> ' +
'contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">' +
'CC-BY-SA</a>. Tiles &copy; <a href="https://carto.com/attributions">' +
'Carto</a>';

var map;
let map;

$(document).ready(function() {
var tiles = L.tileLayer(TILES_URL, {attribution: ATTRIBUTION});
const tiles = L.tileLayer(TILES_URL, {attribution: ATTRIBUTION});
map = L.map('map', {zoomControl: false}).addLayer(tiles).setView(INITIAL_LOCATION, INITIAL_ZOOM);
var zoomHome = L.Control.zoomHome();
const zoomHome = L.Control.zoomHome({imageSource: 'dist/home-solid.png'});
zoomHome.addTo(map);
});
</script>
Expand Down