Hi Pascal,<div><br></div><div>Your solution seems to confused to me.</div><div><br></div><div>The OpenLayers.Map is applied to an HTML element, a DIV actually. </div><div>You can create the button in the HTML, instead to create a jQuery function to do so. </div>

<div>You can create only the toggle to the click event on this button, to show/hide the DIV that is applied the OL.map(). </div><div><br></div><div>Give a try on this way,</div><div class="gmail_extra"><br clear="all"><p style="font-family:Corbel,Arial,Helvetica,sans-serif;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:14px">

</p><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"></p><p style="font-family:Corbel,Arial,Helvetica,sans-serif;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:14px">

<table style="width:400px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:12px;color:rgb(51,51,51)"><tbody><tr><td><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:16px">

<strong style="color:rgb(28,119,155)">Fernando Norte</strong></p><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">Desenvolvedor SIGWeb</p><p style="margin-top:20px;margin-right:0px;margin-bottom:0px;margin-left:0px">

tel.(31) 2533.9900</p><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">cel.(31) 9119.8814</p><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">skype: fernandoglobalgeo</p>

</td><td><img src="http://globalgeo.com.br/assinaturas/logo.png" border="0" style="display:block;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"></td></tr></tbody></table></p><p style="color:rgb(51,51,51);font-size:12px;margin-top:20px;margin-right:0px;margin-bottom:0px;margin-left:0px">

Endereço: Alameda do Ingá, 88, 6º andar, Vale do Sereno</p><p style="color:rgb(51,51,51);font-size:12px;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">Nova Lima/MG - CEP: 34.000-000</p><p style="color:rgb(51,51,51);font-size:12px;margin-top:5px;margin-right:0px;margin-bottom:30px;margin-left:0px">

<a href="http://www.globalgeo.com.br/" style="color:rgb(28,119,155);text-decoration:none;font-weight:bold" target="_blank">www.globalgeo.com.br</a></p><p style="color:rgb(51,51,51);font-size:9px">"O presente documento pode conter material confidencial ou seu sigilo é protegido por lei.<br>

Quaisquer informações nele contida são destinadas exclusivamente ao(s) seu(s) destinatário(s)<br>não devendo em nenhuma hipótese ser repassado a terceiros".</p><p></p><p></p><p></p><br>
<br><br><div class="gmail_quote">2012/12/4 pascal <span dir="ltr"><<a href="mailto:pascal2833@gmail.com" target="_blank">pascal2833@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hi,<br>
<br>
I want to show/not show a map in Open Layer by the use of a button (create<br>
with JQuery).<br>
This is my code  (espace_map1 = id create by var map_element1= new<br>
OpenLayers.Map("espace_map1") ).<br>
<br>
// Create button:<br>
$('#button_map1').button();<br>
// TOGGLE /BOUTTON 1:<br>
var clic_b1= function click_b1(){createmap1();};<br>
var clic2_b1= function click2_b1(){$("#espace_map1").remove();};<br>
<br>
$(function toggle_fonct()<br>
{<br>
$("#boutton_map1").toggle(click_b1,click2_b1);<br>
}); // end toogle fonction<br>
<br>
•       The toogle function works (if click2_b1 = alert(« something ») ; these<br>
lines create the map and then write something and then create the map etc …<br>
•       But in this case, i can't see the map after the click2. I've tried with<br>
.hide() (and not remove) but it's the same.<br>
How can i solve this problem ?<br>
Thanks a lot !<br>
<br>
Pascal.<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://osgeo-org.1560.n6.nabble.com/Show-and-hide-maps-with-a-button-in-OpenLayers-tp5020705.html" target="_blank">http://osgeo-org.1560.n6.nabble.com/Show-and-hide-maps-with-a-button-in-OpenLayers-tp5020705.html</a><br>


Sent from the OpenLayers Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>
</blockquote></div><br></div>