首页 > 解决方案 > 试图将数据添加到我的 Leaflet web 地图中的另一个“选项卡”?

问题描述

我似乎无法弄清楚如何离开我的“主页”并在另一个页面上插入新数据。

下面是我到目前为止开发的 HTML!我试过弄乱几个不同的部分,但我似乎无法进入我的新闻页面!

</head>

<body>

    <!-- Header Section -->
    <header>
        <div class="head1">Turkey, Through The Ages</div>
        <div class="head2">An educational and interactive experience</div>
    </header>

    <!-- Menu Navigation Bar -->
    <div class="menu">
        <a href="#home">HOME</a>
        <a href="#news">NEWS</a>
        <a href="#notification">NOTIFICATIONS</a>
        <div class="menu-log">
            <a href="#login">LOGIN</a>
        </div>
    </div>

    <!-- Body section -->
    <div class = "body_sec">
        <section id="Content">
            <h3>Interactive Map</h3>
        </section>
    </div>
    <head>
    <title>Turkey, Through the Ages</title>
    <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
    <script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
    <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>


    <style>
    #my-map {
        width:2000px;
        height:1000px;
    }
    </style>
    </head>

    <body>
        <div id="my-map"></div>
    <script>
    window.onload = function () {
        var basemap = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
            attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
        });

        $.getJSON("turk.geojson", function(data) {

        var geojson = L.geoJson(data, {
          onEachFeature: function (feature, layer) {
            layer.bindPopup(feature.properties.Area_Name);
          }
        });


标签: htmlleaflet

解决方案


推荐阅读