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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 16:06:23
Original
1447 people have browsed it

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"
  }); 
});
Copy after login

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

Related labels:
Statement of this Website
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
Latest Issues
What are JavaScript hook functions?
From 1970-01-01 08:00:00
0
0
0
What is JavaScript garbage collection?
From 1970-01-01 08:00:00
0
0
0
c++ calls javascript
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template