我建立一个caroufredsel为响应网站(只有3种状态:960px
,720px
和320px
).当您在其中一个状态下加载页面时,它工作得很好.它显示正确的项目数(分别为3,2和1).但是,当您调整窗口大小时,可见项目的数量不会更改.我正在考虑一个$(window).resize()
电话,但我无法找到如何在初始化后调整Caroufredsel设置.
$('#caroufredsel').carouFredSel({
infinite: true,
auto: false,
pagination: false,
prev: {
button: '#prev',
key: 'left'
},
swipe: {
onTouch: true,
onMouse: true
},
next: {
button: '#next',
key: 'right'
},
items: {
visible: 'variable'
}
});
Run Code Online (Sandbox Code Playgroud) 客户要求我计算从某个地址到固定地址的距离.我使用Google Distance Matrix API制作了一个PHP脚本来计算距离.但是,这并没有给我最短的距离.它似乎只是给了谷歌认为最好的东西.例如,我的脚本在2个地址之间返回11.7公里,而Google地图则提供以下结果:
如你所见,8.7km与11.7km相比差别很大.
我会考虑除Google Distance Matrix API之外的其他选项.
我的剧本:(简而言之)
if ($this->getVar('to', false) && $this->getVar('to', false) != '') {
$to = urlencode(urldecode($this->getVar('to', false)));
$url = 'http://maps.googleapis.com/maps/api/distancematrix/json?origins=Etterbeeksesteenweg+180+Brussel&destinations='.$to.'&mode=driving&language=nl-BE&sensor=false';
$this->view->response = json_decode(file_get_contents($url));
}
Run Code Online (Sandbox Code Playgroud)
我试图添加&alternatives=true
,但没有成功.