do something when user hovers over point on map.

This commit is contained in:
sanj 2010-09-19 04:43:23 +05:30
parent 30edb01ffc
commit 7a56e9ddd5
2 changed files with 18 additions and 4 deletions

View File

@ -58,20 +58,23 @@ $(function() {
map.addLayers(layers); map.addLayers(layers);
map.setCenter(center, 12); map.setCenter(center, 12);
mapControl = new OpenLayers.Control.SelectFeature(layers[1], {hover: false}); mapControl = new OpenLayers.Control.SelectFeature(layers[1], {hover: true});
zoomControl = new OpenLayers.Control.ZoomToMaxExtent(); zoomControl = new OpenLayers.Control.ZoomToMaxExtent();
map.addControl(mapControl); map.addControl(mapControl);
// map.addControl(zoomControl); // map.addControl(zoomControl);
mapControl.activate(); mapControl.activate();
// zoomControl.activate(); // zoomControl.activate();
layers[1].events.on({ layers[1].events.on({
'featureselected': onFeatureSelect 'featureselected': onFeatureSelect,
'featureunselected': onFeatureUnselect
}); });
}); });
function onFeatureSelect(f) { function onFeatureSelect(f) {
$.noop(); var id = f.feature.attributes.id;
// $('img').removeClass('mapSelect');
$('[data-id=' + id + ']').find('img').addClass("mapSelect");
/* /*
var id = f.feature.attributes.id; var id = f.feature.attributes.id;
$.getJSON("flyover", {'id': id}, function(json) { $.getJSON("flyover", {'id': id}, function(json) {
@ -84,6 +87,10 @@ function onFeatureSelect(f) {
*/ */
} }
function onFeatureUnselect(f) {
var id = f.feature.attributes.id;
$('[data-id=' + id + ']').find('img').removeClass("mapSelect");
}
//will highlight the feature id's passed in arr //will highlight the feature id's passed in arr
function highlightFeatures(arr) { function highlightFeatures(arr) {

View File

@ -58,12 +58,14 @@ a img {
.imageWrapper { .imageWrapper {
float: left; float: left;
width: 140px; width: 100px;
height: 100px;
text-align: center; text-align: center;
} }
.imagesWrapper { .imagesWrapper {
overflow: auto; overflow: auto;
margin-top: 10px;
} }
.videoCategory { .videoCategory {
@ -102,6 +104,11 @@ a img {
-webkit-box-shadow: 0px 0px 1.5em; -webkit-box-shadow: 0px 0px 1.5em;
box-shadow: 0px 0px 1.5em; box-shadow: 0px 0px 1.5em;
} }
.mapSelect {
width: 100px;
height: 100px;
}
</style> </style>
<title>Vertical Urbanism: Flyovers in Mumbai</title> <title>Vertical Urbanism: Flyovers in Mumbai</title>
<link rel="stylesheet" type="text/css" href="/static/css/colorbox.css" /> <link rel="stylesheet" type="text/css" href="/static/css/colorbox.css" />