当前位置:网站首页>Imitate Baidu API of Baidu map page of a website
Imitate Baidu API of Baidu map page of a website
2022-07-24 05:38:00 【amogogo12】
Map page
The illustration is as follows :
Some in the code CSS and JS The document is useless , Test yourself
The code is as follows :
<!doctype html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<base href="https://dt.sofang.com/" />
<script src="/js2.0/jquery-1.11.0.min.js"></script>
<link rel="stylesheet" type="text/css" href="/layui/css/layui.css" />
<title> Ruihe Jincheng _ Datong Rui and Jincheng Real Estate _ House price trend _ Datong SouFun </title>
<meta name="keywords" content=" Ruihe Jincheng | Datong XinPan , Datong new building , SouFun net , Search room - SouFun net "/>
<meta name="description" content=" SouFun net , Datong new house provides you with details of Rui and Jincheng 、 Rui and Jincheng photo album 、 Ruihe Jincheng house type 、 Ruihe Jincheng price , Datong XinPan , Let you have a more comprehensive understanding of the new real estate , Create the best new house purchase experience for you !"/>
<link rel="stylesheet" href="/css20/list.css?v=1650155485">
<link rel="stylesheet" href="/css20/community/detail.css?v=1650155485">
<link rel="stylesheet" href="/css2.0/articleIndex.css?v=1650155485">
<script src="/js/chart/Chart.js"></script>
<script src="/js2.0/jquery.qrcode.min.js"></script>
<script src="/js/point_interest.js?v=1.5.9"></script>
<script src="/js2.0/userFollow.js?v=1.5.9"></script>
<link rel="stylesheet" href="/css20/component/popup_window.css?v=1.5.9">
<link rel="stylesheet" type="text/css" href="/css20/discount_component.css?t=1650155485" />
<script> var con = '[]'; </script>
</head>
<body>
<div id="map" style="padding-top: 32px;float: left;">
<div class="map" style="position: relative;">
<div class="map-title">
Location perimeter
</div>
<div class="" style="margin-top: 12px;">
Location : North of Xijing street in the urban area Plot on the west side of Yong'an Road
</div>
<div class="" style="height: 50px;">
<ul class="map-ul" style="margin-top: 12px;">
<li class="click curpos"> Property location </li>
<li class="chechData" attr=" transit " title=" The surrounding buses "> transit </li>
<li class="chechData" attr=" metro " title=" Surrounding subway "> metro </li>
<li class="chechData" attr=" education " title=" Peripheral Education "> education </li>
<li class="chechData" attr=" The hospital " title=" Surrounding hospitals "> The hospital </li>
<li class="chechData" attr=" Bank " title=" Peripheral bank "> Bank </li>
<li class="chechData" attr=" shopping " title=" Shopping around "> shopping </li>
<li class="chechData" attr=" Restaurant " title=" Surrounding catering "> Restaurant </li>
<li class="chechData" attr=" Bodybuilding " title=" Peripheral fitness "> Bodybuilding </li>
</ul>
</div>
<div id="container" style="width: 1200px;height: 530px;margin-top: 8px;float: left;"></div>
<div class="assort_nav" style="background-color:white;width: 330px;height: 533px;border: 1px solid rgba(219,222,226,1);position: absolute;right: 0px;top:103px;">
<div id="zk" class="zk"></div>
<h2 id="soukey" style="margin-left:16px;background-color:white;height:57px;width: 298px;border-bottom:1px solid rgba(219,222,226,1);font-size:16px;font-family:MicrosoftYaHei;color:rgba(48,49,51,1);line-height:57px;"></h2>
<div id="r-result" style="height: 478px;overflow-y: auto;"></div>
</div>
</div>
</div>
<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=Y1kG709UBP4L0ac6SvTjxnm7"></script>
<script type="text/javascript"> $(document).ready(function () {
// Longitude and latitude var longitude = "0"; var latitude = "0"; if ((longitude == 0) && (longitude == 0)) {
longitude = 113.366546; latitude = 40.087993; } var map = new BMap.Map("container"); // Create a map instance var point = new BMap.Point(longitude, latitude); // Create point coordinates map.centerAndZoom(point, 15); map.enableScrollWheelZoom(true); // Default tag function curpos() {
map.clearOverlays(); // Current real estate address var marker2 = new BMap.Marker(point); // Create annotations map.addOverlay(marker2); var opts = {
position: point, // Specifies the geographic location of the text annotation offset: new BMap.Size(-45, -50) // Set text offset } var label = new BMap.Label(" Current property location ", opts); // Create text annotation objects label.setStyle({
color: "red", fontSize: "12px", height: "20px", lineHeight: "20px", fontFamily: " Microsoft YaHei " }); map.addOverlay(label); } // Click around $('.chechData').bind('click', function (e) {
e.stopPropagation(); e.preventDefault(); var data1 = $(this).attr('attr'); var data2 = $(this).text(); chechData(data1, data2); $(this).addClass("click"); $(this).siblings().removeClass("click") }); function chechData(data1, data2) {
$('#soukey').text(data2); $('.periphery_nav').hide(); $('.periphery_build').show(); curpos(); $('.assort_nav').show(); $('soukey').html('<i></i>' + data2); var circle = new BMap.Circle(point, 1000, {
fillColor: "blue", strokeWeight: 1, fillOpacity: 0.3, strokeOpacity: 0.3 }); map.addOverlay(circle); var local = new BMap.LocalSearch(map, {
renderOptions: {
map: map, panel: "r-result", autoViewport: false}, // renderOptions: {map: map}, pageCapacity: 6, onSearchComplete: function (results) {
console.log(results) } }); local.searchNearby(data1, point, 1000); } $('.curpos').click(function (e) {
e.stopPropagation(); e.preventDefault(); var c_name = " Address name "; var c_address = " North side of urban street Plot on the west side of Yong road "; $(this).siblings().removeClass("click"); $(this).addClass("click"); map.clearOverlays(); // Current real estate address var marker2 = new BMap.Marker(point); // Create annotations map.addOverlay(marker2); var opts = {
width: 100, // Information window width height: 70, // Information window height title: " The name of the property :" + c_name, // Message window title offset: new BMap.Size(-5, -20) // Set text offset } var infoWindow = new BMap.InfoWindow(" Address :" + c_address, opts); // Create information window object map.openInfoWindow(infoWindow, point); // Open the message window $('.assort_nav').hide(); }).trigger('click'); }); </script></body>
</html>
The longitude and latitude inside and the text can be used after modification . If it helps you, please like . Please forgive me if there is any mistake
边栏推荐
- The repetition detection function of PHP multi line text content and count the number of repetitions
- 波卡生态发展不设限的奥义——多维解读平行链
- Logic development analysis of LP dual currency liquidity pledge mining system
- MySQL 批量插入demo
- Web3 Foundation grant program empowers developers to review four successful projects
- Moonbeam orbiters program: provides a new way for collectors to participate in moonbeam and Moonriver
- Analysis of Dao liquidity dual currency pledge mining development principle
- WASM VS EVM,波卡的选择预示了公链未来
- Hurry in!! Easily master the three structures of "sequence", "branch" and "cycle" of C language
- 按钮 渐变
猜你喜欢

Canvas - rotate

Sunset: noontide target penetration vulnhub

How to forcibly uninstall Google browser? Don't worry about Google opening as a whiteboard. It's effective for personal testing.

What is the function of key

B站视频评论爬取——以鬼灭之刃为例(并将其存储到csv中)

还原ui设计稿

盘点波卡生态潜力项目 | 跨链特性促进多赛道繁荣

响应式页面

MySQL之索引&执行计划

Inventory Poka ecological potential project | cross chain characteristics to promote the prosperity of multi track
随机推荐
XML之建模
Function analysis of GeoServer rest API
助力传统游戏转型GameFi,Web3Games推动游戏发展新航向
新建 umi 项目,Error: Rendered more hooks 或者 Rendered fewer hooks
LP双币流动性质押挖矿系统逻辑开发分析
Create a new UMI project, error: rendered more hooks or rendered fewer hooks
PyCharm设置代码模板
Gavin wood, founder of Poka: what will happen to Poka governance V2?
Geoserver自动化上传Shapefile
网页内嵌B站视频,隐藏相关控件
Logic development analysis of LP dual currency liquidity pledge mining system
How to export Excel files with php+mysql
Canvas - fill
量化合约夹子套利机器人系统逻辑开发原理分析
Web3基金会「Grant计划」赋能开发者,盘点四大成功项目
Vulnhub solidstate: 1 target penetration test
Tabs tab (EL tabs)_ Cause the page to jam
项目免费部署到公网(内网穿透)
Insanity:1(Insanity-Hosting)靶机渗透 —Vulnhub
16进制转rgb