城市切换
来源:互联网 发布:js设置form的action 编辑:程序博客网 时间:2024/04/28 13:23
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>code.js.cn</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body, html
{
margin: 0;
padding: 0;
font-size: 12px;
font: 12px/1.5 arial;
background: #A2DDEF;
}
#head
{
background: #454545;
height: 110px;
}
.shell
{
margin: 20px 0 0 50px;
}
.shell strong
{
background: #606060;
color: #eee;
font-size: 16px;
padding: 5px 20px;
margin-left: 60px;
}
.shell span
{
color: #fff;
font-size: 12px;
margin-left: 10px;
cursor: pointer;
}
#logo img
{
border: none;
}
#menu
{
position: absolute;
background: #515151;
color: #eee;
padding: 4px;
}
#menu ul, #menu li
{
margin: 0;
padding: 0;
list-style: none;
}
#menu li a
{
display: block;
font-size: 14px;
color: #fff;
text-decoration: none;
zoom: 1;
}
#menu li a:hover, #menu li.focus a
{
background: #606060;
}
#menu li
{
float: left;
display: inline;
width: 78px;
line-height: 25px;
text-align: center;
margin-left: 4px;
}
#menu ul
{
border-bottom: 1px dashed #666;
float: left;
padding: 5px;
width: 340px;
}
.menufoot
{
clear: both;
text-align: right;
padding: 10px;
}
.menufoot a
{
color: #339999;
text-decoration: none;
padding: 5px 10px;
}
.menufoot a:hover
{
background: #606060;
color: #339999;
text-decoration: none;
}
.nav
{
background: #44ABAF;
height: 70px;
border-top: 4px solid #338888;
}
</style>
</head>
<body>
<div id="head">
<div class="shell">
<a href="###" id="logo">
<img src="http://www.meituan.com/static//css/i/logo.gif" alt="" /></a> <strong>深圳</strong><span
id="menuBtn">切换城市</span></div>
</div>
<div class="nav">
</div>
<div id="menu" style="display: none;">
<ul>
<li><a href="">北京</a></li>
<li><a href="">上海</a></li>
<li><a href="">武汉</a></li>
<li><a href="">广州</a></li>
<li class="focus"><a href="">深圳</a></li>
<li><a href="">杭州</a></li>
<li><a href="">南京</a></li>
<li><a href="">成都</a></li>
<li><a href="">天津</a></li>
<li><a href="">西安</a></li>
<li><a href="">福州</a></li>
<li><a href="">重庆</a></li>
<li><a href="">厦门</a></li>
<li><a href="">青岛</a></li>
<li><a href="">大连</a></li>
</ul>
<div class="menufoot">
<a href="">其它城市?</a></div>
</div>
</body>
<script type="text/javascript">
//<![CDATA[
ldh = {
get: function (el) {
return typeof el == "string" ? document.getElementById(el) : el;
},
on: function (el, type, fn) {
el = this.get(el);
el.attachEvent ?
el.attachEvent('on' + type, function () { fn.call(el, event) }) :
el.addEventListener(type, fn, false);
return this
},
align: function (el, el2, x, y) {
var rect = this.get(el2).getBoundingClientRect(), x = x || 0, y = y || 0;
el.style.top = rect.top + this.get(el2).offsetHeight + y + 'px';
el.style.left = rect.left + x + 'px'
},
stop: function (e) {
e = e || window.event;
e.stopPropagation && e.stopPropagation();
e.cancelBubble = true
},
onblur: function (el, fn) {
el = this.get(el);
this.on(el, 'click', function (e) {
ldh.stop()
}).on(document, 'click', function (e) {
el.style.display = 'none';
});
return this
}
};
ldh.onblur('menu').on('menuBtn', 'click', function () {
var css = ldh.get('menu').style;
if (css.display != 'none') return;
ldh.align(ldh.get('menu'), this, -85, 10);
css.display = 'block';
ldh.stop();
})
//]]>
</script>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>code.js.cn</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body, html
{
margin: 0;
padding: 0;
font-size: 12px;
font: 12px/1.5 arial;
background: #A2DDEF;
}
#head
{
background: #454545;
height: 110px;
}
.shell
{
margin: 20px 0 0 50px;
}
.shell strong
{
background: #606060;
color: #eee;
font-size: 16px;
padding: 5px 20px;
margin-left: 60px;
}
.shell span
{
color: #fff;
font-size: 12px;
margin-left: 10px;
cursor: pointer;
}
#logo img
{
border: none;
}
#menu
{
position: absolute;
background: #515151;
color: #eee;
padding: 4px;
}
#menu ul, #menu li
{
margin: 0;
padding: 0;
list-style: none;
}
#menu li a
{
display: block;
font-size: 14px;
color: #fff;
text-decoration: none;
zoom: 1;
}
#menu li a:hover, #menu li.focus a
{
background: #606060;
}
#menu li
{
float: left;
display: inline;
width: 78px;
line-height: 25px;
text-align: center;
margin-left: 4px;
}
#menu ul
{
border-bottom: 1px dashed #666;
float: left;
padding: 5px;
width: 340px;
}
.menufoot
{
clear: both;
text-align: right;
padding: 10px;
}
.menufoot a
{
color: #339999;
text-decoration: none;
padding: 5px 10px;
}
.menufoot a:hover
{
background: #606060;
color: #339999;
text-decoration: none;
}
.nav
{
background: #44ABAF;
height: 70px;
border-top: 4px solid #338888;
}
</style>
</head>
<body>
<div id="head">
<div class="shell">
<a href="###" id="logo">
<img src="http://www.meituan.com/static//css/i/logo.gif" alt="" /></a> <strong>深圳</strong><span
id="menuBtn">切换城市</span></div>
</div>
<div class="nav">
</div>
<div id="menu" style="display: none;">
<ul>
<li><a href="">北京</a></li>
<li><a href="">上海</a></li>
<li><a href="">武汉</a></li>
<li><a href="">广州</a></li>
<li class="focus"><a href="">深圳</a></li>
<li><a href="">杭州</a></li>
<li><a href="">南京</a></li>
<li><a href="">成都</a></li>
<li><a href="">天津</a></li>
<li><a href="">西安</a></li>
<li><a href="">福州</a></li>
<li><a href="">重庆</a></li>
<li><a href="">厦门</a></li>
<li><a href="">青岛</a></li>
<li><a href="">大连</a></li>
</ul>
<div class="menufoot">
<a href="">其它城市?</a></div>
</div>
</body>
<script type="text/javascript">
//<![CDATA[
ldh = {
get: function (el) {
return typeof el == "string" ? document.getElementById(el) : el;
},
on: function (el, type, fn) {
el = this.get(el);
el.attachEvent ?
el.attachEvent('on' + type, function () { fn.call(el, event) }) :
el.addEventListener(type, fn, false);
return this
},
align: function (el, el2, x, y) {
var rect = this.get(el2).getBoundingClientRect(), x = x || 0, y = y || 0;
el.style.top = rect.top + this.get(el2).offsetHeight + y + 'px';
el.style.left = rect.left + x + 'px'
},
stop: function (e) {
e = e || window.event;
e.stopPropagation && e.stopPropagation();
e.cancelBubble = true
},
onblur: function (el, fn) {
el = this.get(el);
this.on(el, 'click', function (e) {
ldh.stop()
}).on(document, 'click', function (e) {
el.style.display = 'none';
});
return this
}
};
ldh.onblur('menu').on('menuBtn', 'click', function () {
var css = ldh.get('menu').style;
if (css.display != 'none') return;
ldh.align(ldh.get('menu'), this, -85, 10);
css.display = 'block';
ldh.stop();
})
//]]>
</script>
</html>
- 城市切换
- 城市切换
- 百度Map切换城市
- php多城市切换
- Android仿美团切换城市
- Android仿美团切换城市
- 高德切换城市
- Android仿美团切换城市
- Android仿美团切换城市
- 城市列表切换
- 微信小程序 仿美团城市选择 城市切换
- 微信小程序 城市选择器 城市切换
- IOS 定位城市和切换城市
- 微信小程序 仿美团城市选择 城市切换
- 微信小程序 仿美团城市选择 城市切换
- 微信小程序 仿美团城市选择 城市切换
- 51job城市选择切换
- 微信小程序之城市切换
- 分析了一下360安全卫士的hook(zt)
- JavaScript中的this到底是什么?
- Qt4实现将调试信息保存到日志
- 滚轮自动滑到底部
- Android帧缓冲区(Frame Buffer)硬件抽象层(HAL)模块Gralloc的实现原理分析
- 城市切换
- struts2 jpg文件上传失败 Content-Type not allowed
- 360安全卫士hookport.sys简单逆向
- opengl api
- myeclipse的若干问题
- Linux下的lua和boost c++的搭建和安装
- Linux与Windows分区格式详解
- oracle启动 /停止的几种方法以及 启动和停止过程中出错的解决办法
- How To Determine Table/View Name in a Form