Jquery show() not working in FF
I have issues with FF & Jquery .show().
my website shows an emb开发者_StackOverflowedded map from google in clicking a link.i have got a javascript function that handle this, in safari it works great.FF won't show the map.
this is the js. function:
function mostraPagina(nome){
if (nome='mappa'){
$('#mappa').load('contenuti/mappe/mappa_thiene.html');
$('#dark_background').show(600);
$('#mappa').show(600);
}
}
the embedded code from google maps is:
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=Via+Murialdo,+4,+Thiene+italy&sll=45.710686,11.475665&sspn=0.002439,0.005676&ie=UTF8&hq=&hnear=Via+Murialdo,+4,+36016+Thiene+Vicenza,+Veneto,+Italy&ll=45.710222,11.475618&spn=0.001219,0.002838&t=h&z=14&output=embed"></iframe>
thank you very much.
One possible problem:
if (nome='mappa'){
You're assigning the value of nome
to 'mappa'
which evaluates to true always (because of the way non-empty strings typecast to true). Your code should probably be
if (nome=='mappa'){
are you sure this
if (nome='mappa'){
is what you want? that would just be like if(true)
should be:
if (nome == 'mappa'){
which does the comparison you are looking for I guess
but ACTUALLY it should be:
if (nome === 'mappa'){
which not only comparse the value, but also the type. Well why not do a regexp test?
if (/^mappa$/.test(nome)){
:)
精彩评论