百度地图标点鼠标样式更改
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                百度地图标点鼠标样式更改
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.                        
                                需求:修改百度地圖紅點(diǎn)懸停鼠標(biāo)樣式,有鏈接的鼠標(biāo)懸停顯示為pointer點(diǎn)擊跳轉(zhuǎn),沒(méi)有鏈接的紅點(diǎn)懸停后顯示鼠標(biāo)默認(rèn)樣式。
分析1:
百度地圖官方JSAIP2.0?http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference.html#a3b2
百度地圖JS 核心對(duì)象:
API方法查找與鼠標(biāo)相關(guān)的方法:
| 事件 | 參數(shù) | 描述 | 
| click | event{type, target} | 點(diǎn)擊標(biāo)注圖標(biāo)后會(huì)觸發(fā)此事件 | 
| dblclick | event{type, target, point,pixel} | 雙擊標(biāo)注圖標(biāo)后會(huì)觸發(fā)此事件 | 
| mousedown | event{type, target, point,pixel} | 鼠標(biāo)在標(biāo)注圖上按下觸發(fā)此事件 | 
| mouseup | event{type, target, point,pixel} | 鼠標(biāo)在標(biāo)注圖上釋放觸發(fā)此事件 | 
| mouseout | event{type, target, point,pixel} | 鼠標(biāo)離開(kāi)標(biāo)注時(shí)觸發(fā)此事件 | 
| mouseover | event{type, target, point,pixel} | 當(dāng)鼠標(biāo)進(jìn)入標(biāo)注圖標(biāo)區(qū)域時(shí)會(huì)觸發(fā)此事件 | 
分析2:
默認(rèn)百度地圖該實(shí)例紅點(diǎn)鼠標(biāo)懸停為小手(pointer)樣式,添加mouseover事件,找到紅點(diǎn)dom對(duì)象控制其css
查看mouseover事件的參數(shù),F12后查看找到紅點(diǎn)dom對(duì)象的style,嘗試后找到為止為type.currentTarget.V.style。
最終解決代碼:
marker.addEventListener("mouseover", function(type, target, point,pixel){ //console.log(type);type.currentTarget.V.style.cursor ="default";});?
總結(jié)
以上是生活随笔為你收集整理的百度地图标点鼠标样式更改的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
                            
                        - 上一篇: JAVA练习题17:文字版格斗游戏
 - 下一篇: XY6762/XY6765/XY8788