0
我已經建立了我的圖像映射與jQuery的插件mapster如何等待jquery-plugin(imagemapster)中的用戶交互?
的代碼顯示了我,哪些國家被點擊( '1' 爲埃及, '2' Libyia ..)
$(document).ready(function() {
function geklickt (e){
//alert(typeof e.key); return string
$('.showme').append(e.key+ ' ');
}
$('img').mapster({
mapKey: 'ALT',
stroke: true,
strokeWidth: 2,
strokeColor: 'ff0000' ,
onConfigured: function(){
// howto set up loop for asking user here???
} ,
onClick: geklickt
});
});
我問題: 我想問用戶在不同的國家這樣一個循環: 「點擊埃及」
if (e.key == '1')
{
// message "Ok"
// add one point
}
else
{
// message "NOT Ok"
}
「點擊突尼斯」 ......
我不知道如何編碼這個循環,以便用戶被要求爲第一個國家,然後程序等待,直到用戶點擊國家 ,然後用戶被問到第二個國家....
感謝
庫爾特
添加了一行初始化數組。就像我說的那樣,它並不完整 - 只是爲了向你展示你需要做什麼。 這個工作適合你嗎? – ramblinjan 2012-04-09 01:07:56
是的!非常感謝你! – Kurt 2012-04-09 06:13:44