我遇到了在Firefox中正確顯示/隱藏行爲的問題。網站在Chrome/Safari中運行。現在不擔心IE。JQuery .hide()在FireFox中不工作
網站是在這裏:
http://chrismcaleenan.com/map/?page_id=6
你可以看到希望的行爲,當用戶鼠標懸停/鼠標移開/點擊在Chrome/Safari瀏覽器在地圖上的狀態(忽略插圖 - 這仍然是一項正在進行的工作)。在Firefox中,該站點似乎處理鼠標懸停,但不是鼠標懸停或點擊。
這就是我認爲是相關的代碼,但錯誤可能是在實際的CSS或其它地方:
//actions on poly mouseover
for (var i = 0; i < statesPoly.length; i++) {
(function(i){
google.maps.event.addListener(eval(statesPoly[i]), 'mouseover', function() {
this.setOptions({ strokeWeight: '2' });
$("#"+statesPoly[i]).addClass("highlight");
if(map.getZoom() <= 6)
$('#supp_data'+i).show();
});
})(i);
}
//actions on poly click
var zoomArray = new Array();
for (var i = 0; i < statesPoly.length; i++) {
zoomArray[i]=0;
(function(i){
google.maps.event.addListener(eval(statesPoly[i]), 'click', function() {
if (!zoomArray[i]) {
map.panTo(eval(stateCenters[i]));
map.setZoom(7);
polyArray[i].setOptions({ fillOpacity: '0' });
zoomArray[i] = 1;
$('#supp_data'+i).hide();
$('#inset-map').hide();
}
else {
map.panTo(myLatLng);
map.setZoom(6);
$('#inset-map').show();
//for some reason bug causes 11,12 to skip - adding manual reset
polyArray[i].setOptions({ fillOpacity: '.8' });
zoomArray[i] = 0;
polyArray[11].setOptions({ fillOpacity: '.8' });
zoomArray[11] = 0;
polyArray[12].setOptions({ fillOpacity: '.8' });
zoomArray[12] = 0;
for (n = 0; n < polyArray.length; n++) {
polyArray[n].setOptions({ fillOpacity: '.8' });
zoomArray[n] = 0;
}
}
});
})(i);
}
//actions on table mouseover
for (var i = 0; i < statesPoly.length; i++) {
(function(i){
google.maps.event.addDomListener(document.getElementById(statesPoly[i]), 'mouseover', function() {
$("#"+statesPoly[i]).addClass("highlight");
polyArray[i].setOptions({ strokeWeight: '2' });
if(map.getZoom() <= 6)
$('#supp_data'+i).show();
});
})(i);
}
//actions on table click
var zoomArray = new Array();
for (var i = 0; i < statesPoly.length; i++) {
zoomArray[i]=0;
(function(i){
google.maps.event.addDomListener(document.getElementById(statesPoly[i]), 'click', function() {
if (!zoomArray[i]) {
map.panTo(eval(stateCenters[i]));
map.setZoom(7);
polyArray[i].setOptions({ fillOpacity: '0' });
zoomArray[i] = 1;
$('#supp_data'+i).hide();
$('#inset-map').hide();
}
else {
map.panTo(myLatLng);
map.setZoom(6);
$('#inset-map').show();
//for some reason bug causes 11,12 to skip - adding manual reset
polyArray[i].setOptions({ fillOpacity: '.8' });
zoomArray[i] = 0;
polyArray[11].setOptions({ fillOpacity: '.8' });
zoomArray[11] = 0;
polyArray[12].setOptions({ fillOpacity: '.8' });
zoomArray[12] = 0;
for (n = 0; n < polyArray.length; n++) {
polyArray[n].setOptions({ fillOpacity: '.8' });
zoomArray[n] = 0;
}
}
});
})(i);
}
//actions on poly mouseout
for (var i = 0; i < statesPoly.length; i++) {
(function(i){
google.maps.event.addListener(eval(statesPoly[i]), 'mouseout', function() {
this.setOptions({ strokeWeight: '1' });
$("#"+statesPoly[i]).removeClass("highlight");
$('#supp_data'+i).hide();
});
})(i);
}
//actions on table mouseout
for (var i = 0; i < statesPoly.length; i++) {
(function(i){
google.maps.event.addDomListener(document.getElementById(statesPoly[i]), 'mouseout', function() {
$("#"+statesPoly[i]).removeClass("highlight");
polyArray[i].setOptions({ strokeWeight: '1' });
$('#supp_data'+i).hide();
});
})(i);
}
當您嘗試在Firefox中進行調試時,它會說什麼? – Joey
不會引發任何錯誤。 –