[OpenLayers-Users] jquey & open layers

beppe beppenapo at gmail.com
Fri Apr 2 19:55:06 EDT 2010


Hi all,
I'm using ol with jquery and I've seen that if I include jquery library
in my page, controls disappear (panzoom, mouseposition ...); if I remove
the library it works.

Someone has my problem?

This is a snippet of my page [1], and my map [2]

thanks

-beppe-



[1]
<title>Aramus - Excavations and Field School</title>
	<script type="text/javascript"
src="../lib/proj4s/lib/proj4js.js"></script>
	<script type="text/javascript" src="lib/map2.js"></script>
	<script type="text/javascript"
src="../lib/proj4s/lib/defs/EPSG32638.js"></script>
	<script type="text/javascript" src="lib/OpenLayers.js"></script>
	<script
src="http://www.openstreetmap.org/openlayers/OpenStreetMap.js"></script>
	<script type="text/javascript" src="lib/jquery-1.4.2.min.js"></script>
	<script type="text/javascript"
src="lib/jquery-ui-1.8.custom.min.js"></script>
	<link href="css/layout.css" type="text/css" rel="stylesheet"
media="screen" />
	<link rel="shortcut icon" href="/aramus/img_layout/ico.jpg" />
	<script type="text/javascript">
	   $(document).ready(function(){
		 $('#riduci').hide();
		 
		 $('#espandi').click(function(){
		   $('#pageHeader, #linkList').hide(3000);
			$("#map").animate( {width:"100%", left:"0px" }, { queue:false,
duration:3000 } )
		   $('#riduci').show();
		   $('#espandi').hide();	   
	    });
		 
		 $('#riduci').click(function(){
		   $('#pageHeader, #linkList').show(3000);
		   $("#map").animate( {width:"746px", left:"226px" }, { queue:false,
duration:3000 } );
		   $('#riduci').hide();
		   $('#espandi').show();	   
	    });
	    
	 	  });
	</script>

[2] 
        OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";

        var zoom=15        
        var map; //complex object of type OpenLayers.Map
        function init() {
				var epsg32638= new OpenLayers.Projection("EPSG:32638");
				var epsg900913= new OpenLayers.Projection("EPSG:900913");
				 
            map = new OpenLayers.Map ("map", {
                controls:[
           new OpenLayers.Control.Navigation(),
           new OpenLayers.Control.PanZoomBar(),
           new OpenLayers.Control.LayerSwitcher({activeColor:"green"}),
           new OpenLayers.Control.MousePosition({element:
$('location')}),
                    new OpenLayers.Control.Attribution()],
                  maxExtent: bounds,
                maxResolution: 2.1797578125001564,
                numZoomLevels: 11,
                units: 'm',
                projection: epsg900913,
 OpenLayers.Projection("EPSG:900913")
                displayProjection: new
OpenLayers.Projection("EPSG:4326")
            } );
            var bounds = new OpenLayers.Bounds(44.532, 40.144, 45.038,
40.423).transform(map.displayProjection, map.projection);

 OpenLayers.Layer.OSM.Maplint and OpenLayers.Layer.OSM.CycleMap
            
            layerTilesAtHome = new
OpenLayers.Layer.OSM.Osmarender("Osmarender");
            map.addLayer(layerTilesAtHome);
            
            layerMapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik");
			   map.addLayer(layerMapnik);
			   
   			layerCycleMap = new OpenLayers.Layer.OSM.CycleMap("CycleMap");
	   		map.addLayer(layerCycleMap);
				
	//OpenLayers.Layer.Vector with Protocol.HTTP and Strategy.Fixed
	var wfs = new OpenLayers.Layer.Vector("isoipse", {
                    strategies: [new OpenLayers.Strategy.Fixed()],
                    protocol: new OpenLayers.Protocol.HTTP({
                    url: "../aramus_data/vector/gml/isoipse.gml",
                    projection: epsg32638,
                    format: new OpenLayers.Format.GML()
                    })
                });
	 map.addLayer(wfs);
         map.zoomToExtent(bounds);
        }




More information about the Users mailing list