小编Rub*_*ben的帖子

谷歌在jsFiddle中映射

我正试图在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)

javascript google-maps jsfiddle

1
推荐指数
1
解决办法
4973
查看次数

无法在回调中设置角度变量

我正在使用谷歌地图路线服务来计算旅行时间。

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()

javascript google-maps directions typescript angular

1
推荐指数
1
解决办法
1367
查看次数

包含文件内容php

我想将php文件中的内容包含到另一个php文件中.(它在wordpress网站中)
包含或要求不起作用,因为它只包括文件,我需要内容本身.
file_get_contents也无法正常工作,因为它只显示我的php代码而不执行它.

我必须使用什么功能?

php file include

0
推荐指数
1
解决办法
3046
查看次数

带有可点击项的CSS3圈jQuery(径向菜单)

我在哪里可以找到一个用css3和jQuery创建这样一个圆圈的例子(用于导航)中心
应该有文本(html)
当你点击(或悬停)下一个项目时,中心内容应该改变,同时也是背景颜色

在此输入图像描述

html css jquery css3 css-shapes

-3
推荐指数
1
解决办法
6268
查看次数