首先,来看下效果图(样式什么的就不必吐槽了哈)
搜索记录:
//用于保存记录信息
* {
margin: 0;
padding: 0;
}
input {
border: 0;
vertical-align: middle;
float: left;
}
#searchbox {
width: 300px;
height: 50px;
background: #fff;
margin: 100px auto;
border: 1px solid #ccc;
position: relative;
}
#inpt {
width: 240px;
height: 50px;
outline: none;
text-indent: 10px;
}
#btn {
width: 60px;
height: 50px;
cursor: pointer;
}
/* 历史记录框 */
#historybox {
width: 280px;
padding: 10px 10px 50px;
border: 1px solid #ccc;
position: absolute;
top: 50px;
left: -1px;
/* 隐藏 */
display: none;
}
#historybox h3 {
margin-bottom: 10px;
}
#list {
list-style: none;
}
#list .on {
float: left;
border: 1px solid #ccc;
background: #aaa;
height: 30px;
line-height: 30px;
margin: 0 2px;
border: 1px solid #ccc;
border-radius: 5px;
}
#list .active {
color: #fff;
text-decoration: none;
padding: 2px;
}
$(function () {
let max_history = 7;// 存储最大历史数据
// 鼠标移入事件
$('#inpt').on('focus', function () {
$('inpt').val = '';
let data = localStorage.getItem('data'); //从本地存储中读取数据
if (!data) {
$('#historybox').
总结
以上所述是小编给大家介绍的使用开发者网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!