Почему страница, загруженная на сервер spaceWeb отличается от той, что развёрнута локально у меня на компьютере?
Создал простой сайт с картой OpenStreetMap, загрузил на сервер не так давно, но заметил, что есть некоторые различия между ними -
- на сайте, что с сервера нет логотипа страницы
- Определение координат не работает, если заходить с компьютера - если же зайти с телефона, то всё в полном порядке.
- Чекбокс гораздо меньшего размера, чем на сайте, который расположен на компе.
Собственно, вот ссылка на сам сайт https://www.geokrasnodar.ru/
В чём может быть дело?
// Создание слоя OSM на странице сайта var centerpos = [38.997190, 45.130683]; var newpos = ol.proj.transform(centerpos, 'EPSG:4326', 'EPSG:900913'); // Установка визуализации OSM var view = new ol.View({ projection: 'EPSG:900913', center: newpos, zoom: 2, maxZoom: 20, minZoom: 5, extent: [4262967.307515293, 5592508.683331995, 4429711.492867963, 5697114.645076073] }); // Установка слоя ОСМ var map = new ol.Map({ layers: [ new ol.layer.Tile({ source: new ol.source.OSM({ tileSize: 512, maxResolution: 180 / 512, wrapX: true, view: view, }), })], keyboardEventTarget: document, target: 'map', view: view, minExtent: 10, }); // Получить координаты щелчком мыши map.on('click', function (e) { let coord = e.coordinate console.log(coord); }) //Создание иконки местонахождения пользователя var geolocation = new ol.Geolocation({ trackingOptions: { enableHighAccuracy: true, }, projection: view.getProjection(), }); function el(id) { return document.getElementById(id); } el('whereAmI').addEventListener('change', function () { geolocation.setTracking(this.checked); console.log(geolocation.projection); }); var accuracyFeature = new ol.Feature(); geolocation.on('change:accuracyGeometry', function () { accuracyFeature.setGeometry(geolocation.getAccuracyGeometry()); console.log(accuracyFeature); }); var positionFeature = new ol.Feature(); positionFeature.setStyle( new ol.style.Style({ image: new ol.style.Circle({ radius: 6, fill: new ol.style.Fill({ color: '#3399CC', }), stroke: new ol.style.Stroke({ color: '#fff', width: 2, }), }), }) ); geolocation.on('change:position', function () { var coordinates = geolocation.getPosition(); positionFeature.setGeometry(coordinates ? new ol.geom.Point(coordinates) : null); }); new ol.layer.Vector({ map: map, source: new ol.source.Vector({ features: [accuracyFeature, positionFeature], }), });body{ padding:0; margin:0; overflow: hidden; } a{ text-decoration:none; color: blue; } #map { height: 100vh; position: absolute; top: 0px; right: 0px; bottom: 0px; left: 0px; z-index: 2; margin-bottom: 50px; } #chbxTrack{ z-index: 3; position: absolute; right: 220px; bottom:0px; font-size: 28px; } #track{ width: 20px; height:20px; border-radius:50%; } #coord{ position: absolute; left: 2.5em; bottom: .8em; z-index:101; background: none; color: black; font-size: 20px; } #I { z-index: 102; width: 66px; height: 66px; position: absolute; right: 1.4em; bottom: 2.5em; } #whereAmI { z-index: 0; width: 65px; height: 65px; background: url(../images/arrowMe.png); background-size: 65px 65px; border: 0px; border-radius: 50%; -moz-border-radius: 50%; -webkit-border-radius: 50%; } #whereAmI :active, .whereAmI:focus{ outline: none; } #whereAmI ::-moz-focus-inner{ border: 0; } #whereAmI{ cursor:pointer; } /*.ol-attribution{ background:black; }*/<!DOCTYPE HTML> <html> <head> <meta http-equiv="content-type" content="text/html" charset="utf-8" /> <title>ГеоКраснодар</title> <link rel="shortcut icon" type="image/x-icon" href="images/logo2.png" /> <link rel="stylesheet" href="styles/style.css" /> <link rel="stylesheet" href="css/ol.css" type="text/css"> <script src="build/ol.js"></script> </head> <body> <div class="container"> <div id="map" ></div> <div id="I"> <input id="whereAmI" onclick="coordinateUser()" value="" type="checkbox" /> </div> <script defer="defer" src="scripts/script.js"></script> </div> </body> </html>
Ответы (1 шт):
Автор решения: Nickolai Bondarenko
→ Ссылка
Решил проблему перезапуском браузера Не знаю, с чем это может быть связано, но думаю, что проблема крылась в кэше браузера