sdasd

HTML

<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css">
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
<div id="map1" style="height:150px"></div>
<div id="map2" style="height:150px"></div>

JavaScript

function createMap(id) {
    
     if (typeof map == 'undefined'){
        map = {};
        layer_bg = {};
    }
    
    map[id] = L.map(id.toString(10)).setView([51.505, -0.09], 6);
    layer_bg[id] = new L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png');
    
    map[id].on('mouseover', function(e) {
        console.log(id);
        map[id].addLayer( layer_bg[id] ); });
    map[id].on('mouseout', function(e) { 
        map[id].removeLayer( layer_bg[id] ); });   
}

createMap("map1");
createMap("map2");

/**/