Home > Web Front-end > JS Tutorial > body text

Javascript implements Baidu map mouse sliding event display and hiding_javascript skills

WBOY
Release: 2016-05-16 16:06:23
Original
1369 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:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!