Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

javascript error found when map is resized by code, in IE8 and firefox #1203

Open
wuyinudt opened this issue Dec 13, 2013 · 1 comment
Open

Comments

@wuyinudt
Copy link

=================description========================
I'm using OL 2.13.1 on IE8 or filefox on WINXP
I made the base layer as tiled and the overlay layer as singleTiled.
In my application, the size of map div changes to the size of browser window.
sometimes when the user resizes the browser window, it comes an javascript error: this.layer is null
everytime when the browser enters fullscreen mode, the same error happens
help me please
=================code=======================

<script src="http://openlayers.org/api/OpenLayers.js"></script> <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ var map = new OpenLayers.Map('map'); var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS", "http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic'}); map.addLayer(wms);
var dm_wms = new OpenLayers.Layer.WMS(
        "Canadian Data",
        "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap",
        {
            layers: "bathymetry,land_fn,park,drain_fn,drainage," +
                "prov_bound,fedlimit,rail,road,popplace",
            transparent: "true",
            format: "image/png"
    },
    {
        isBaseLayer: false,
        singleTile: true
    }
);
map.addLayer(dm_wms);
map.zoomToMaxExtent();


$(window).resize(function(){
    var w = $(window).width();
    var h = $(window).height();
    $("#map").width(w/2);
    $("#map").height(h/2);
            map.updateSize();
});

});
</script>

@wuyinudt
Copy link
Author

=================code=======================

<script src="http://openlayers.org/api/OpenLayers.js"></script> <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ var map = new OpenLayers.Map('map'); var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS", "http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic'}); map.addLayer(wms);
var dm_wms = new OpenLayers.Layer.WMS(
        "Canadian Data",
        "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap",
        {
            layers: "bathymetry,land_fn,park,drain_fn,drainage," +
                "prov_bound,fedlimit,rail,road,popplace",
            transparent: "true",
            format: "image/png"
    },
    {
        isBaseLayer: false,
        singleTile: true
    }
);
map.addLayer(dm_wms);
map.zoomToMaxExtent();


$(window).resize(function(){
    var w = $(window).width();
    var h = $(window).height();
    $("#map").width(w/2);
    $("#map").height(h/2);
            map.updateSize();
});

});
</script>

@wuyinudt wuyinudt reopened this Dec 13, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant