Skip to content

Instantly share code, notes, and snippets.

@DeaVenditama
Created August 23, 2020 00:17
Show Gist options
  • Save DeaVenditama/d77bed7c6ad6acc99a893bacf5fca6ee to your computer and use it in GitHub Desktop.
Save DeaVenditama/d77bed7c6ad6acc99a893bacf5fca6ee to your computer and use it in GitHub Desktop.
<?= $this->extend('layout') ?>
<?= $this->section('head') ?>
<script src="<?= base_url('leaflet/leaflet.js') ?>"></script>
<link rel="stylesheet" href="<?= base_url('leaflet/leaflet.css') ?>" />
<style>
#maps {
height: 500px;
}
</style>
<?= $this->endSection() ?>
<?= $this->section('content') ?>
<h1>Peta Indonesia</h1>
<div id="maps"></div>
<?= $this->endSection() ?>
<?= $this->section('script') ?>
<script>
var map = L.map('maps').setView({ lat : 0.7893, lon : 113.9213 }, 5);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '&copy; <a href="https://openstreetmap.org/copyright">OpenStreetMap contributors</a>'
}).addTo(map);
L.marker({lat : 0.7893, lon : 113.9213}).bindPopup('Hello Indonesia').addTo(map);
</script>
<?= $this->endSection() ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment