简体   繁体   English

上传到服务器后未显示Google Map,在本地工作正常

[英]Google Map not showing after uploading to server, locally works fine

I'm trying to implement a simple page that have google maps enabled, but I'm having an issue where my google maps marker is not showing after uploading the files to the hosting, it works fine locally. 我正在尝试实现一个启用了Google Maps的简单页面,但是我遇到一个问题,在将文件上传到托管后,我的Google Maps标记未显示,在本地运行良好。

Here's the script I'm using 这是我正在使用的脚本

 var styles = [ { "featureType":"landscape", "stylers":[ {"saturation":-100}, {"lightness":65}, {"visibility":"on"} ] }, { "featureType":"poi", "stylers":[ {"saturation":-100}, {"lightness":51}, {"visibility":"simplified"} ] }, { "featureType":"road.highway", "stylers":[ {"saturation":-100}, {"visibility":"simplified"} ] }, { "featureType":"road.arterial", "stylers":[ {"saturation":-100}, {"lightness":30}, {"visibility":"on"} ] }, { "featureType":"road.local", "stylers":[ {"saturation":-100}, {"lightness":40}, {"visibility":"on"} ] }, { "featureType":"transit", "stylers":[ {"saturation":-100}, {"visibility":"simplified"} ] }, { "featureType":"administrative.province", "stylers":[{"visibility":"on"} ] }, { "featureType":"water", "elementType":"labels", "stylers":[ {"visibility":"on"}, {"lightness":-25}, {"saturation":-100} ] }, { "featureType":"water", "elementType":"geometry", "stylers":[ {"hue":"#ffffff"}, {"lightness":0}, {"saturation":0} ] } ]; $("#my-map").gmap3({ marker:{ address: '96 New Moor St, Colombo' }, map:{ options:{ styles: styles, zoom: 14, scrollwheel: false, draggable: true, zoomControl: true, zoomControlOptions: { style: google.maps.ZoomControlStyle.SMALL }, mapTypeControl: false, scaleControl: false, scrollwheel: false, streetViewControl: false } } }); // Show Map $(".show-map").click(function(){ if ($(".map").hasClass("opened")) { $(".map").removeClass("opened"); $(".show-map i").removeClass("fa-minus"); $(".show-map span").text("Show Map"); } else { $(".map").addClass("opened"); $(".show-map i").addClass("fa-minus"); $(".show-map span").text("Hide Map"); } }); 

The snippet gives error "$ is not defined" . 该代码段给出错误“未定义$”。 I think you missed the JQuery import in your code , while uploading files to server, because that seems to be the issue. 我认为您在将文件上传到服务器时错过了代码中的JQuery导入,因为这似乎是问题所在。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 上传到服务器后未显示Google Map标记,在本地工作正常 - Google Map marker not showing after uploading to server, locally works fine Ajax调用在Google Cloud Platform中返回404-在本地工作正常吗? - Ajax calls return 404 in Google Cloud Platform - works fine locally? Nodemailer,在本地工作正常,但在我的服务器上不起作用 - Nodemailer, works fine locally but doesn't work on my server 将文件上传到服务器后显示服务器响应 - Showing server response after uploading a file to the server 上传到s3后无法查看PDF。 上传图像效果很好(NodeJS) - unable to view PDF after uploading to s3. uploading images works fine (NodeJS) Javascript 在本地工作,但不在服务器上 - Javascript works locally but not on the server 为什么我的 Post Request 在部署到 Google 的 GAE 时失败,但在本地运行良好? - Why does my Post Request fail when deployed on Google's GAE, but works fine locally? Socket.io在服务器上返回Uncaught RangeError和文字javascript代码,但在本地运行良好 - Socket.io returning Uncaught RangeError and literal javascript code on server, but works fine locally 简单的AJAX JS在Safari中可以在本地正常运行,在服务器和Firefox中无法运行(带有evalJSON()的问题)? - Simple AJAX JS works fine locally in Safari, fails on server and in Firefox (issue with evalJSON())? 服务器文件在本地工作正常,但一旦部署(在 Heroku 上),MongoDB 返回“false”而不是 JSON - Server file works fine locally, but once deployed (on Heroku), MongoDB returns “false” instead of JSON
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM