modify streetView
by essoduke chang
HTML
<script src="//maps.google.com/maps/api/js?sensor=false"></script>
<script src="http://app.essoduke.org/js/tinyMap/jquery.tinyMap-3.1.7.min.js"></script>
<div id="map" class="map"></div>
CSS
.map{width:320px;height:200px;margin-bottom:1em;}
JavaScript
var map = $('#map'),
m = {};
// Direction
map.tinyMap({
'center': ['25.034516521123315','121.56496524810791'],
'zoom': 16,
'autoLocation': true,
'event': {
'idle': {
'func': function () {
map.tinyMap('modify', {
direction: [
{
from: this.center,
to: '台北車站'
}
]
});
this.panTo(this.center);
},
'once': true
}
}
});
/*
navigator.geolocation.getCurrentPosition(function (pos) {
map.tinyMap({
center: pos.coords,
direction: [{
from: pos.coords,
to: '台北車站'
}]
});
});
*/