SubClosure

{ Don't Repeat Yourself ! }

Browsing Posts published in May, 2011

Safari, Chrome and Firefox work great with the facebook like button.

But to get internet explorer to display it I had to add the facebook namespace to my html tag.

e.g.
<html  xmlns:fb=”http://www.facebook.com/2008/fbml”
xmlns:og=”http://opengraphprotocol.org/schema/” … >

 

Probably one of the first things you would want to do with an openlayers map is adding some interaction.
Amazingly it is difficult to find an easy and quick example on how to do it.

Here is an example on how to move an Openlayer.Marker to the point where a user clicked on the map.

 

var markers = new OpenLayers.Layer.Markers( "Markers" );
marker = new OpenLayers.Marker(lonLat) ;
markers.addMarker(marker);
map.addLayer(markers);

map.events.register("click", map , function(e){
var opx = map.getLayerPxFromViewPortPx(e.xy) ;
marker.map = map ;
marker.moveTo(opx) ;
});


Another example can be found on the openlayers examples page.
I found it a bit overkill though and more difficult to use.

This error occurs on line 915 in Openlayers.js.

If you get this error when using the moveTo method of an OpenLayers.Marker object  set the map on the marker first.

e.g.

mymarker.map = map ;
mymarker.moveTo(opx ) ;

 

 

Get Adobe Flash player