CSS custom cursor mouse cursor style

Browser compatibility varies, it is best to use cur or ico format. Cur file size must be set to 32*32 

Basic usage: cursor:default

Customize the mouse style: cursor:url('icon path'),default; means that if there is a problem with the icon path, the default style will be applied

{
    cursor:  url('/cursor/crosshair_add.cur') 32 32,url('@/assets/icon/poi_01.svg'), pointer;
}

png is also supported, but not recommended

Set the mouse style in js: (note: pass at least two cursor options, such as cursor="url('cursor1.cur'), ​​default")

 map.getTargetElement().style.cursor ="url(http://pic.ljgis.com/common/cursor/crosshair_add.cur) 32 32,default";

Guess you like

Origin blog.csdn.net/qq_40323256/article/details/130928231