2016-06-11 67 views

回答

1
var your_variable = ""; 
// solution 1 
// by click 
$('#your_button').click(function(){ 
your_variable= target_color; 
// run the initialization again 
test(); 
}); 

function test(){ 
set = $('#map').vectorMap({ 
//...code 
selectedColor: your_variable 
//...code 
}); 
} 

// solution 2 
$('#your_button').click(function(){ 
$('#map').vectorMap("set", "selectedColor", your_variable); 
}); 

希望這個作品