采用gmaps v3以及指定到全屏高度并自动滚动
This commit is contained in:
parent
7845c99a92
commit
af8fa13c61
|
@ -9,42 +9,56 @@ $this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
|
||||||
$this->breadcrumb('<a href="/data/timeline">时空导航</a>');
|
$this->breadcrumb('<a href="/data/timeline">时空导航</a>');
|
||||||
$this->breadcrumb()->setSeparator(' > ');
|
$this->breadcrumb()->setSeparator(' > ');
|
||||||
//$this->headScript()->appendFile('http://maps.google.cN/maps?file=api&v=2&key='.$this->config->google->maps->api);
|
//$this->headScript()->appendFile('http://maps.google.cN/maps?file=api&v=2&key='.$this->config->google->maps->api);
|
||||||
|
$this->headScript()->appendFile('http://maps.google.cN/maps/api/js?sensor=false');
|
||||||
$this->headScript()->appendFile('/js/timeline_var.js');
|
$this->headScript()->appendFile('/js/timeline_var.js');
|
||||||
$this->headScript()->appendFile('/js/timeline_js/timeline-api.js');
|
$this->headScript()->appendFile('/js/timeline_js/timeline-api.js');
|
||||||
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
|
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
|
||||||
$this->headScript()->appendFile('/js/timemap.2.0.1/lib/mxn/mxn.js?(google)');
|
$this->headScript()->appendFile('/js/timemap.2.0.1/lib/mxn/mxn.js?(googlev3)');
|
||||||
$this->headScript()->appendFile('/js/timemap.2.0.1/timemap.pack.js');
|
$this->headScript()->appendFile('/js/timemap.2.0.1/timemap.pack.js');
|
||||||
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
|
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
|
||||||
$this->headLink()->appendStylesheet('/css/colorbox.css');
|
$this->headLink()->appendStylesheet('/css/colorbox.css');
|
||||||
?>
|
?>
|
||||||
<div class="row-fluid"><?= $this->partial('data/tools.phtml'); ?></div>
|
<div class="row-fluid"><?= $this->partial('data/tools.phtml'); ?></div>
|
||||||
<div id="timemap" style="clear:both;">
|
<div id="timemap">
|
||||||
<div id="timeline" style="height:300px;width:100%;"></div>
|
<div id="map" style="height:500px;width:50%;float:right;"></div>
|
||||||
<div id="map" style="height:300px;"></div>
|
<div id="timeline" style="height:500px;border-right:1px solid #abc;"></div>
|
||||||
</div>
|
|
||||||
<script type="text/javascript" charset="utf-8">
|
|
||||||
var tm;
|
|
||||||
$(window).bind("load", function() { var timeout = setTimeout(function() { initLoader(); }, 100);});
|
|
||||||
//$(window).bind("load", function() { var timeout = setTimeout(function() { gmaploaded(); }, 1000);});
|
|
||||||
function loadMaps() {
|
|
||||||
google.load("maps", "2", {"callback" : tmloaded,"base_domain": "ditu.google.cn"});
|
|
||||||
}
|
|
||||||
|
|
||||||
function initLoader() {
|
</div>
|
||||||
var script = document.createElement("script");
|
<script type="text/javascript" charset="utf-8">
|
||||||
script.src = "https://www.google.com/jsapi?key=<?php echo $this->config->google->maps->api; ?>&callback=loadMaps";
|
$('#map').height($(window).height());
|
||||||
script.type = "text/javascript";
|
$('#timeline').height($(window).height());
|
||||||
document.getElementsByTagName("head")[0].appendChild(script);
|
$("html,body").animate({scrollTop:$('#timemap').offset().top},600);
|
||||||
}
|
var tm;
|
||||||
function tmloaded() {
|
$(function() {
|
||||||
tm = TimeMap.init({
|
|
||||||
mapId: "map", // Id of map div element (required)
|
// make a custom map style
|
||||||
timelineId: "timeline", // Id of timeline div element (required)
|
var styledMapType = new google.maps.StyledMapType([
|
||||||
options: {
|
{
|
||||||
eventIconPath: "../images/",
|
featureType: "water",
|
||||||
mapType:G_NORMAL_MAP
|
elementType: "all",
|
||||||
|
stylers: [
|
||||||
|
{ saturation: 0 },
|
||||||
|
{ lightness: 100 }
|
||||||
|
]
|
||||||
},
|
},
|
||||||
datasets: [
|
{
|
||||||
|
featureType: "all",
|
||||||
|
elementType: "all",
|
||||||
|
stylers: [
|
||||||
|
{ saturation: -100 }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
], {
|
||||||
|
name: "white"
|
||||||
|
});
|
||||||
|
|
||||||
|
tm = TimeMap.init({
|
||||||
|
mapId: "map", // Id of map div element (required)
|
||||||
|
timelineId: "timeline", // Id of timeline div element (required)
|
||||||
|
options: {
|
||||||
|
eventIconPath: "../images/"
|
||||||
|
},
|
||||||
|
datasets: [
|
||||||
{
|
{
|
||||||
id: "artists",
|
id: "artists",
|
||||||
title: "Artists",
|
title: "Artists",
|
||||||
|
@ -60,29 +74,17 @@ function tmloaded() {
|
||||||
<?php if ($row['timeend']!='') : ?>
|
<?php if ($row['timeend']!='') : ?>
|
||||||
"end" : "<?php echo $row['timeend']; ?>",
|
"end" : "<?php echo $row['timeend']; ?>",
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
"polygon" : [
|
"point" :
|
||||||
{
|
{
|
||||||
"lat" : <?php echo $row['south']; ?>,
|
"lat" : <?php echo ($row['south']+$row['north'])/2; ?>,
|
||||||
"lon" : <?php echo $row['west']; ?>
|
"lon" : <?php echo ($row['west']+$row['east'])/2; ?>
|
||||||
},{
|
},
|
||||||
"lat" : <?php echo $row['north']; ?>,
|
"title" : "<?php echo htmlspecialchars($row['title']); ?>",
|
||||||
"lon" : <?php echo $row['west']; ?>
|
|
||||||
},{
|
|
||||||
"lat" : <?php echo $row['north']; ?>,
|
|
||||||
"lon" : <?php echo $row['east']; ?>
|
|
||||||
},{
|
|
||||||
"lat" : <?php echo $row['south']; ?>,
|
|
||||||
"lon" : <?php echo $row['east']; ?>
|
|
||||||
},{
|
|
||||||
"lat" : <?php echo $row['south']; ?>,
|
|
||||||
"lon" : <?php echo $row['west']; ?>
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"title" : "<?php echo $row['title']; ?>",
|
|
||||||
"options" : {
|
"options" : {
|
||||||
// set the full HTML for the info window
|
// set the full HTML for the info window
|
||||||
"infoHtml": "<a href=/data/<?php echo $row['uuid']; ?>><?php echo $row['title']; ?></a><hr /><img src=/service/thumb/id/<?php echo $row['id']; ?> onclick='$.colorbox({photo:\"true\",href:\"/service/bigthumb/id/<?php echo $row['id']; ?>\"});' />"
|
"infoHtml": "<div class='info'><a href=/heihe/view/uuid/<?php echo $row['uuid']; ?>><?php echo htmlspecialchars($row['title']); ?></a><hr /><img src=/service/thumb/id/<?php echo $row['id']; ?> onclick='$.colorbox({photo:\"true\",href:\"/service/bigthumb/id/<?php echo $row['id']; ?>\"});' /></div>",
|
||||||
}
|
"theme":"orange"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
]
|
]
|
||||||
|
@ -94,6 +96,11 @@ function tmloaded() {
|
||||||
Timeline.DateTime.DECADE
|
Timeline.DateTime.DECADE
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
// manipulate the timemap further here if you like
|
|
||||||
}
|
// set the map to our custom style
|
||||||
|
var gmap = tm.getNativeMap();
|
||||||
|
gmap.mapTypes.set("white", styledMapType);
|
||||||
|
gmap.setMapTypeId("white");
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue