Hongmu Notes
Home Summary of pitfalls Website access to Baidu map
Summary of pitfalls

Website access to Baidu map

Website access to Baidu map

Now define an id box in html

<div id="maps"></div>

Next, introduce Baidu js file:

<script src="//api.map.baidu.com/api?type=webgl&v=1.0&ak=IqqChZ4B0uzoth1C2YpdRD78ZcgsIorC"></script>
 <script>
    var map = new BMapGL.Map('maps');
    var point = new BMapGL.Point({label:ip});
    map.centerAndZoom(point, 18);
    map.enableScrollWheelZoom(true);  
    // 创建点标记
    var marker = new BMapGL.Marker(point);
    map.addOverlay(marker);
    // 创建信息窗口
    var opts = {
        width: 200,
        height: 100,
        title: '{pboot:companyname}'
    };
    var infoWindow = new BMapGL.InfoWindow('地址:{pboot:companyaddress}', opts);
    // 点标记添加点击事件
    marker.addEventListener('click', function () {
        map.openInfoWindow(infoWindow, point); // 开启信息窗口
    });
</script>
微信赞赏

WeChat

支付宝赞赏

Alipay

✍️ Author: Hong Mu

webmaster · Thanks for reading, stay tuned for more exciting content

Author homepage View home page →

Related articles

Browser caching increases the speed of secondary visits to your website

Browser caching increases the speed of secondary visits to your website Summary of pitfalls

Use browser caching of official words: If users will visit your website multiple times, browser caching of static resources can save users time. Cache headers should be applied to all cacheable static resources, not just to a small subset of static resources (for example, images). Cacheable resources include JS and CSS files, image files, and other binary object files (media files, PDF files, etc.). Normally, HTML doesn’t…
👁 202

Recommended reading

Responsive, marketing-oriented sports and fitness equipment website template – 0690

Responsive, marketing-oriented sports and fitness equipment website template – 0690 Practical Collection Yiyou template

An eyouCMS responsive website template designed for marketing-oriented fitness equipment manufacturers. Its dynamic and professional design effectively showcases fitness equipment products, workout programs, and brand strength. This template helps fitness equipment manufacturers showcase their products online and attract both gym members and home users. Template Overview | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Common Installation Questions for YouyouCMS...
👁 49
Aerobic Sports Website Template 0691

Aerobic Sports Website Template 0691 Practical Collection Yiyou template

This EyouCMS template is ideal for websites dedicated to aerobic sports and fitness activities. Its vibrant and dynamic design is perfect for showcasing sports events, fitness programs, athletic competitions, and sports equipment. It helps sports and fitness organizations attract sports enthusiasts online and enhance their brand awareness. Template Display | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for EyouCMS | EyouCMS...
👁 35
Responsive fitness and body sculpting corporate website template 0692

Responsive fitness and body sculpting corporate website template 0692 Practical Collection Yiyou template

An eyouCMS responsive website template designed for fitness and body shaping businesses. Its vibrant and healthy design effectively showcases fitness classes, body shaping programs, the coaching team, and the club environment. This template helps fitness institutions attract members online and enhance their brand awareness. Template Display | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for EyouCMS | EyouCMS (E...
👁 44
Resource website typecho001 template

Resource website typecho001 template Program Notes Typecho

typecho001 template template please do not modify the folder name of this template. The folder name is: typecho001 1.4 Fix the js output problem on the article page 1.3 Fix the error prompt when the plug-in is not installed Optimize the list page code output 1.2 Fix the comment function and add a custom homepage title 1.1 Fix the comment reply asymmetry function Add a separate title setting function on the homepage Add the website favicon.ico icon Add one...
👁 198
Treadmill Fitness Equipment Website Template 0693

Treadmill Fitness Equipment Website Template 0693 Practical Collection Yiyou template

This EyouCMS template is ideal for the treadmill and fitness equipment industry, featuring a vibrant and healthy design style perfect for showcasing fitness equipment products, treadmill ranges, workout plans, and brand imagery. It helps fitness equipment brands effectively present their products online and attract both gym members and home users. Template Preview | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Common Questions About EyouCMS Installation...
👁 49
Modification of typecho paging style

Modification of typecho paging style Program Notes Typecho

Sir, times have changed! Typecho is currently the most perfect solution, because Baidu can only see the code of fixed thinking. The actual generated HTML code is breathtakingly clean and fully customized, including adding classes to the li element, adding classes to the a element, adding classes to the previous page and next page, and removing the li tags that come with typecho to express more. I can even add some text to the content inside...
👁 517