Home >Web Front-end >JS Tutorial >Javascript implements Baidu map mouse sliding event display and hiding_javascript skills

Javascript implements Baidu map mouse sliding event display and hiding_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:06:231425browse

The implementation idea is to set the style for the label. Let’s take a look at the specific method

var label = new BMap.Label("我是文字标注哦",{offset:new BMap.Size(20,-10)});
  label.setStyle({ 
     display:"none" //给label设置样式,任意的CSS都是可以的
  });
marker.setLabel(label);
 
marker.addEventListener("mouseover", function(){ 
  label.setStyle({  //给label设置样式,任意的CSS都是可以的
    display:"block"
  });
     
}); 
 
marker.addEventListener("mouseout", function(){ 
  label.setStyle({  //给label设置样式,任意的CSS都是可以的
    display:"none"
  }); 
});

The above is all the content shared with you in this article. I hope it will be helpful to everyone in learning javascript.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn