优化代码,移除desktop标记,改用设备宽度来判断

This commit is contained in:
Argo-Lenovo 2016-11-20 14:10:26 +08:00
parent 702912d1c8
commit 3093a70025
6 changed files with 38 additions and 52 deletions

View File

@ -96,6 +96,15 @@
} }
} }
@media (min-width: 768px) {
#sidebar {
top: 94px;
bottom: 40px;
position: absolute;
overflow-y: auto;
}
}
@media (min-height: 672px) { @media (min-height: 672px) {
#sidebar { #sidebar {
top: 94px; top: 94px;

View File

@ -153,13 +153,6 @@
position: relative; position: relative;
} }
.desktop #sidebar {
top: 94px;
bottom: 40px;
position: absolute;
overflow-y: auto;
}
ul.sidebar-menu { ul.sidebar-menu {
padding: 20px 0 15px 0; padding: 20px 0 15px 0;
margin-bottom: 0; margin-bottom: 0;

View File

@ -38,6 +38,34 @@
} }
} }
@media (min-width: 768px) {
.header {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 50;
}
.site-footer {
position: fixed;
left: 0;
bottom: 0;
right: 0;
z-index: 50;
}
#main-content {
margin-top: 0;
position: fixed;
left: 0;
bottom: 40px;
right: 0;
top: 94px;
overflow: auto;
}
}
@media (min-height: 672px) { @media (min-height: 672px) {
html, body { html, body {
height: 100%; height: 100%;

View File

@ -61,54 +61,12 @@ a, a:hover, a:focus {
text-transform: uppercase; text-transform: uppercase;
} }
.sidebar-toggle-box:hover, .sidebar-toggle-box:focus {
text-decoration: none;
outline: none;
color: #337ab7;
}
.sidebar-toggle-box span {
padding-left: 6px;
}
.sidebar-toggle-box .fa-bars {
cursor: pointer;
display: inline-block;
font-size: 20px;
}
.site-footer { .site-footer {
background: #5b6e84; background: #5b6e84;
color: #fff; color: #fff;
padding: 10px 4px; padding: 10px 4px;
height: 40px; height: 40px;
} }
.desktop .header {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 50;
}
.desktop .site-footer {
position: fixed;
left: 0;
bottom: 0;
right: 0;
z-index: 50;
}
.desktop #main-content {
margin-top: 0;
position: fixed;
left: 0;
bottom: 40px;
right: 0;
top: 94px;
overflow: auto;
}
/*end title*/ /*end title*/
.go-top { .go-top {

View File

@ -208,6 +208,4 @@ $(function () {
return this.optional(element) || /^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$/.test(value); return this.optional(element) || /^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$/.test(value);
}, "请填写正确的IP地址"); }, "请填写正确的IP地址");
} }
if ($.browser.versions.mobile) { $('body').removeClass('desktop'); }
}); });

View File

@ -10,7 +10,7 @@
<link href="~/Content/css/bootstrap-theme.css" rel="stylesheet"> <link href="~/Content/css/bootstrap-theme.css" rel="stylesheet">
@RenderSection("css", false) @RenderSection("css", false)
</head> </head>
<body class="desktop"> <body>
@RenderBody() @RenderBody()
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 --> <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="~/content/js/jquery-1.10.2.js"></script> <script src="~/content/js/jquery-1.10.2.js"></script>