我正试图在jsFiddle中实现谷歌地图问另一个问题,但我看不到地图:http: //jsfiddle.net/hashie5/aknYP/
我在资源中添加了gmap脚本
如何在jsFiddle中显示地图?
function initialize() {
var myLatlng = new google.maps.LatLng(50.965049,5.484231);
var myOptions = {
zoom: 14,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var contentString =
'<div id="infowindow">' +
'Galaconcert<br />' +
'Jaarbeurslaan 2-6<br />' +
'3690 Genk' +
'</div>'
;
var infowindow = new google.maps.InfoWindow();
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Galaconcert'
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(contentString);
infowindow.open(map, marker);
});
}
Run Code Online (Sandbox Code Playgroud) 我正在使用谷歌地图路线服务来计算旅行时间。
this.mapsAPILoader.load().then(() => {
const p1 = new google.maps.LatLng(50.926217, 5.342043);
const p2 = new google.maps.LatLng(50.940525, 5.353626);
const directionsService = new google.maps.DirectionsService();
const request = {
origin: p1,
destination: p2,
travelMode: google.maps.TravelMode.DRIVING,
unitSystem: google.maps.UnitSystem.METRIC,
};
directionsService.route(request, (response, status) => {
if (status === google.maps.DirectionsStatus.OK) {
const point = response.routes[0].legs[0];
// console.log(point.duration.text);
this.travelTimeDriving = point.duration.text;
}
});
});
Run Code Online (Sandbox Code Playgroud)
控制台记录正确的驾驶时间,但我的变量 this.travelTimeDriving 保持为空。
我猜它与回调函数和作用域有关,但我无法修复它。
路由函数也返回无效,没有承诺所以我不能使用 .then()
我想将php文件中的内容包含到另一个php文件中.(它在wordpress网站中)
包含或要求不起作用,因为它只包括文件,我需要内容本身.
file_get_contents也无法正常工作,因为它只显示我的php代码而不执行它.
我必须使用什么功能?
我在哪里可以找到一个用css3和jQuery创建这样一个圆圈的例子(用于导航)中心
应该有文本(html)
当你点击(或悬停)下一个项目时,中心内容应该改变,同时也是背景颜色

google-maps ×2
javascript ×2
angular ×1
css ×1
css-shapes ×1
css3 ×1
directions ×1
file ×1
html ×1
include ×1
jquery ×1
jsfiddle ×1
php ×1
typescript ×1