当前位置:网站首页>Imitation Baidu map realizes the three buttons to switch the map mode by automatically shrinking the bottom
Imitation Baidu map realizes the three buttons to switch the map mode by automatically shrinking the bottom
2022-04-23 20:24:00 【First code】
When developing and using Baidu map , It is found that the mode switching and automatic contraction of Baidu map development is very convenient , Check the web page source code , Found a control that is not encapsulated by a map , yes html Write button .
The code here uses CSS3 transition Property to realize map switching .
<html>
<head>
<style scoped>
#mapType {
width: 106px;
height: 70px;
position: absolute;
bottom: 20px;
right: 20px;
z-index: 2;
cursor: pointer;
border-radius: 5px;
transition: width 0.8s, height 0.8s;
-moz-transition: width 0.8s, height 0.8s, -moz-transform 0.8s; /* Firefox 4 */
-webkit-transition: width 0.8s, height 0.8s, -webkit-transform 0.8s; /* Safari and Chrome */
-o-transition: width 0.8s, height 0.8s, -o-transform 0.8s; /* Opera */
}
#mapType:hover {
width: 288px;
background: rgba(255, 255, 255, 0.3);
}
#mapType .mapTypeCard {
position: absolute;
top: 5px;
width: 86px;
height: 60px;
border-radius: 5px;
border: solid 1px black;
}
#mapType .mapTypeCard span {
width: 36px;
height: 16px;
position: absolute;
bottom: 1px;
right: 1px;
display: inline-block;
font-size: 12px;
line-height: 16px;
text-align: center;
color: #fff;
background: #888f88;
opacity: 0.8;
}
#mapType .vectorType {
background-color: pink;
z-index: 3;
right: 15px;
transition: right 0.8s;
-moz-transition: right 0.8s; /* Firefox 4 */
-webkit-transition: right 0.8s; /* Safari and Chrome */
-o-transition: right 0.8s; /* Opera */
}
#mapType .imgType {
z-index: 2;
right: 10px;
background-color: rgb(118, 118, 201);
transition: right 0.8s;
-moz-transition: right 0.8s; /* Firefox 4 */
-webkit-transition: right 0.8s; /* Safari and Chrome */
-o-transition: right 0.8s; /* Opera */
}
#mapType .terType {
z-index: 1;
right: 5px;
background-color: greenyellow;
transition: right 0.8s;
-moz-transition: right 0.8s; /* Firefox 4 */
-webkit-transition: right 0.8s; /* Safari and Chrome */
-o-transition: right 0.8s; /* Opera */
transition: right 0.8s;
-moz-transition: right 0.8s; /* Firefox 4 */
-webkit-transition: right 0.8s; /* Safari and Chrome */
-o-transition: right 0.8s; /* Opera */
}
#mapType:hover .vectorType {
right: 197px;
}
#mapType:hover .imgType {
right: 101px;
}
#mapType:hover .terType {
right: 5px;
}
#mapType .vectorType:hover,
#mapType .active {
border: solid 1px #31a5f7;
}
#mapType .imgType:hover {
border: solid 1px #31a5f7;
}
#mapType .terType:hover {
border: solid 1px #31a5f7;
}
#mapType .vectorType:hover span,
#mapType .active span {
background: #31a5f7;
}
#mapType .imgType:hover span {
background: #31a5f7;
}
#mapType .terType:hover span {
background: #31a5f7;
}
</style>
</head>
</body>
<div id="map_container"></div>
<div id="mapType">
<div class="mapTypeCard vectorType">
<span> Ordinary </span>
</div>
<div class="mapTypeCard imgType">
<span> satellite </span>
</div>
<div class="mapTypeCard terType" id="terType">
<span> The three dimensional </span>
</div>
</div>
<script type="text/javascript">
document.getElementById("terType").onclick=function(){
alert(" Automatic scaling ");
};
</script>
</body>
</html>
Source code :
版权声明
本文为[First code]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210551267827.html
边栏推荐
- Livego + ffmpeg + RTMP + flvjs to realize live video
- XXXI` Prototype ` displays prototype properties and`__ proto__` Implicit prototype properties
- Identification of bolt points in aerial photography based on perception
- Rédaction de thèses 19: différences entre les thèses de conférence et les thèses périodiques
- Three. Based on ply format point cloud voxel model JS upload interface writing
- Sqoop imports data from Mysql to HDFS using lzop compression format and reports NullPointerException
- Automatically fill in body temperature and win10 task plan
- ArcGIS js api 4. X submergence analysis and water submergence analysis
- 【PTA】L1-002 打印沙漏
- Latest investigation and progress of building intelligence based on sati
猜你喜欢
Shanghai responded that "flour official website is an illegal website": neglect of operation and maintenance has been "hacked", and the police have filed a case
Commit and rollback in DCL of 16 MySQL
SQL Server Connectors By Thread Pool | DTSQLServerTP plugin instructions
[target tracking] pedestrian attitude recognition based on frame difference method combined with Kalman filter, with matlab code
selenium.common.exceptions.WebDriverException: Message: ‘chromedriver‘ executable needs to be in PAT
ArcGIS JS version military landmark drawing (dovetail arrow, pincer arrow, assembly area) fan and other custom graphics
Development of Matlab GUI bridge auxiliary Designer (functional introduction)
上海回應“面粉官網是非法網站”:疏於運維被“黑”,警方已立案
. Ren -- the intimate artifact in the field of vertical Recruitment!
Notes of Tang Shu's grammar class in postgraduate entrance examination English
随机推荐
Leetcode dynamic planning training camp (1-5 days)
Three. Based on ply format point cloud voxel model JS upload interface writing
What is the difference between a host and a server?
Research on open source OCR engine
Shanghai a répondu que « le site officiel de la farine est illégal »: l'exploitation et l'entretien négligents ont été « noirs » et la police a déposé une plainte
【PTA】L2-011 玩转二叉树
Tensorflow 2 basic operation dictionary
Mysql database backup scheme
WordPress插件:WP-China-Yes解决国内访问官网慢的方法
Recognition of high-speed road signs by Matlab using alexnet
Modeling based on catiav6
Es keyword sorting error reason = fielddata is disabled on text fields by default Set fielddata = true on keyword in order
Rédaction de thèses 19: différences entre les thèses de conférence et les thèses périodiques
RT-1052学习笔记 - GPIO架构分析
论文写作 19: 会议论文与期刊论文的区别
Redis installation (centos7 command line installation)
Handwritten Google's first generation distributed computing framework MapReduce
2022dasctf APR x fat epidemic prevention challenge crypto easy_ real
Plato farm is one of the four largest online IEOS in metauniverse, and the transaction on the chain is quite high
[problem solving] 'ASCII' codec can't encode characters in position XX XX: ordinal not in range (128)