0
我不是一個jQuery的人,但在實現jVectormap我已經包括一個onRegionOver函數,當地圖最初加載。但是,它似乎只觸發一次,即#content div的內容只顯示一次,但在將光標移到其他狀態時仍然存在。我錯過了什麼? TIA。jVectormap onRegionOver回調
<script>
$(function(){
$('.jvectormap').vectorMap({
map: 'us_en',
values: associateData,
scaleColors: ['#C8EEFF', '#0071A4'],
normalizeFunction: 'polynomial',
hoverOpacity: 0.7,
hoverColor: false,
onLabelShow: function(e, el, code){
el.html('<strong>'+el.html()+'</strong><br />'+associateData[code]);
},
onRegionOver: function(e, code){
$("#content").replaceWith(contentData[code]);
},
markers: [
{latLng: [43.30, -75.61], name: 'Dans Automotive, Taberg NY', r: 3, fill: 'yellow'},
{latLng: [41.16, -95.93], name: 'Yecks Auto Repair, Bellevue NE', r:3, fill: 'yellow'},
{latLng: [41.36, -81.85], name: 'Parkway Express, Berea OH', r:3, fill: 'yellow'},
{latLng: [41.31, -81.83], name: 'Strongsville Express, Strongsville OH', r:3, fill: 'yellow'},
{latLng: [41.34, -81.53], name: 'Nordonia Tire & Service, Northfield OH', r:3, fill: 'yellow'}
],
onMarkerLabelShow: function(event, label, index){
console.log('label-show', label, index);
},
onMarkerOver: function(event, index){
console.log('marker-over', index);
},
onMarkerOut: function(event, index){
console.log('marker-out', index);
},
onMarkerClick: function(event, index){
var url = "http://www.google.com";
$(location).attr('href',url);
}
});
})
</script>
比約恩,工作完美!非常感謝。 –