提交 c35530bc 编写于 作者: E edisonxiang

add menus in mobile

上级 4c1f5f49
......@@ -10,101 +10,108 @@
<ul class="topbar">
<li class="search">
<img src="/img/earth.svg">
<span>English</span>
{{ range .Site.Menus.main }}
{{ if eq .Identifier "lang" }}
<a class="list" href="{{ .URL }}">{{ .Name }}</a>
{{ end }}
{{ end }}
<i></i>
</li>
<li class="flex" onclick="getList('menu')" style="position:relative">
<img src="/img/nav.svg" alt="导航">
<img src="/img/nav.svg" alt="Navigation">
</li>
</ul>
<div id="nav">
<p class="list">HOME</p>
<p class="second_menu" onclick="getList('secondMenu')">COMMUNITY
{{ range .Site.Menus.main }}
{{ $currentId:= .Identifier }}
{{ if ne $currentId "lang" }}
{{ if .HasChildren }}
<p class="second_menu" onclick="getList('#second_menu_{{ $currentId }}')">{{ .Name }}
<i></i>
</p>
<div class="menu_list" id="second_menu">
<p class="list">NEWS</p>
<p class="list">UPCOMING EVENTS</p>
<p class="list">IRC</p>
<p class="list">MAIL LISTS</p>
<div class="menu_list" id="second_menu_{{ $currentId }}">
{{ range .Children }}
<a class="list" href="{{ .URL }}"><p>{{ .Name }}</p></a>
{{ end }}
</div>
<p class="list">DOCS</p>
<p class="list">DOWNLOAD</p>
<p class="list">CONTACT</p>
{{ else }}
<a class="list" href="{{ .URL }}"><p>{{ .Name }}</p></a>
{{ end }}
{{ end }}
{{ end }}
</div>
</div>
<div class="isPc navbar-affixed-top" data-spy="affix" data-offset-top="200">
<div class="isPc navbar-affixed-top" data-spy="affix" data-offset-top="200">
<div class="navbar navbar-default yamm" role="navigation" id="navbar">
<div class="navbar navbar-default yamm" role="navigation" id="navbar">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand home" href="{{ .Site.BaseURL }}">
<img src="{{ .Site.BaseURL }}{{ .Site.Params.logo }}" alt="{{ .Title }} logo" class="hidden-xs hidden-sm">
<img src="{{ .Site.BaseURL }}{{ .Site.Params.logo_small }}" alt="{{ .Title }} logo"
class="visible-xs visible-sm">
<span class="sr-only">{{ .Title }} - {{ i18n "navHome" }}</span>
</a>
<div class="navbar-buttons">
<button type="button" class="navbar-toggle btn-template-main" data-toggle="collapse"
data-target="#navigation">
<span class="sr-only">{{ i18n "navToggle" }}</span>
<i class="fa fa-align-justify"></i>
</button>
<div class="container">
<div class="navbar-header">
<a class="navbar-brand home" href="{{ .Site.BaseURL }}">
<img src="{{ .Site.BaseURL }}{{ .Site.Params.logo }}" alt="{{ .Title }} logo" class="hidden-xs hidden-sm">
<img src="{{ .Site.BaseURL }}{{ .Site.Params.logo_small }}" alt="{{ .Title }} logo"
class="visible-xs visible-sm">
<span class="sr-only">{{ .Title }} - {{ i18n "navHome" }}</span>
</a>
<div class="navbar-buttons">
<button type="button" class="navbar-toggle btn-template-main" data-toggle="collapse"
data-target="#navigation">
<span class="sr-only">{{ i18n "navToggle" }}</span>
<i class="fa fa-align-justify"></i>
</button>
</div>
</div>
</div>
<!--/.navbar-header -->
<div class="navbar-collapse collapse" id="navigation">
<ul class="nav navbar-nav navbar-right">
{{ $current := . }}
{{ range .Site.Menus.main }}
{{ $topLevel := replace .URL "/" "" }}
{{ $isChildren := false }}
{{ range .Children }}
{{ if eq .Identifier $current.Type }}
{{ $isChildren = true }}
{{ end }}
{{ end }}
<li
class="dropdown{{ if eq $current.RelPermalink .URL | or $isChildren | or (eq (trim $current.RelPermalink "/") $topLevel) | or (eq $current.Type .Identifier) | or (eq $current.Type $topLevel) | or (and (eq (default (trim .URL "/") .Identifier) "blog") (in (slice "taxonomy" "taxonomyTerm") $current.Kind)) }} active{{ end }}">
{{ if .HasChildren }}
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
aria-expanded="false">{{ .Name }} <span class="caret"></span></a>
<ul class="dropdown-menu">
{{ range .Children }}
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
{{ end }}
</ul>
{{ else }}
<a href="{{ .URL }}">{{ .Name }}</a>
{{ end }}
</li>
{{ end }}
</ul>
</div>
<!--/.nav-collapse -->
<!--/.navbar-header -->
<div class="navbar-collapse collapse" id="navigation">
<ul class="nav navbar-nav navbar-right">
{{ $current := . }}
{{ range .Site.Menus.main }}
{{ $topLevel := replace .URL "/" "" }}
{{ $isChildren := false }}
{{ range .Children }}
{{ if eq .Identifier $current.Type }}
{{ $isChildren = true }}
{{ end }}
{{ end }}
<li
class="dropdown{{ if eq $current.RelPermalink .URL | or $isChildren | or (eq (trim $current.RelPermalink "/") $topLevel) | or (eq $current.Type .Identifier) | or (eq $current.Type $topLevel) | or (and (eq (default (trim .URL "/") .Identifier) "blog") (in (slice "taxonomy" "taxonomyTerm") $current.Kind)) }} active{{ end }}">
{{ if .HasChildren }}
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
aria-expanded="false">{{ .Name }} <span class="caret"></span></a>
<ul class="dropdown-menu">
{{ range .Children }}
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
{{ end }}
</ul>
{{ else }}
<a href="{{ .URL }}">{{ .Name }}</a>
{{ end }}
</li>
{{ end }}
</ul>
</div>
<!--/.nav-collapse -->
<div class="collapse clearfix" id="search">
<div class="collapse clearfix" id="search">
<form class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search">
<span class="input-group-btn">
<form class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search">
<span class="input-group-btn">
<button type="submit" class="btn btn-template-main"><i class="fa fa-search"></i></button>
<button type="submit" class="btn btn-template-main"><i class="fa fa-search"></i></button>
</span>
</div>
</form>
</span>
</div>
</form>
</div>
<!--/.nav-collapse -->
</div>
<!--/.nav-collapse -->
</div>
</div>
</div>
<!-- /#navbar -->
<!-- /#navbar -->
</div>
</div>
<!-- *** NAVBAR END ***-->
\ No newline at end of file
<!-- *** NAVBAR END ***-->
\ No newline at end of file
......@@ -23,6 +23,18 @@
padding: 15px 0px;
}
header .topbar .search {
white-space: nowrap;
}
header .topbar .search a.list,
header .topbar .search a.list:hover,
header .topbar .search a.list:active {
color:inherit;
text-decoration: none;
padding: 0 10px;
}
header .navbar-brand {
padding: 5px 0;
height: auto;
......@@ -49,7 +61,7 @@
}
header #nav {
position: absolute;
top: 41px;
top: 39px;
left: 0;
width: 100%;
display: none;
......@@ -63,6 +75,7 @@
line-height: .52rem;
padding: .14rem 0;
font-size: .26rem;
border-bottom: 1px solid #ECECEC;
}
header #nav p:not(:last-child) {
border-bottom: 1px solid #ECECEC;
......@@ -87,6 +100,13 @@
header #nav .menu_list p {
padding: 0.14rem .3rem;
}
header #nav a.list,
header #nav a.list:hover,
header #nav a.list:active {
color:inherit;
text-decoration: none;
border-bottom: 1px solid #ECECEC;
}
.bannernew {
height: 280px;
}
......@@ -422,6 +442,16 @@
list-style-type: none;
padding: 20px 0;
}
header .topbar .search {
white-space: nowrap;
}
header .topbar .search a.list,
header .topbar .search a.list:hover,
header .topbar .search a.list:active {
color:inherit;
text-decoration: none;
padding: 0 10px;
}
header .navbar-brand {
padding: 5px 15px;
}
......@@ -453,6 +483,7 @@
line-height: .52rem;
padding: .14rem 0;
font-size: .28rem;
border-bottom: 1px solid #ECECEC;
}
header #nav p:not(:last-child) {
border-bottom: 1px solid #ECECEC;
......@@ -477,6 +508,13 @@
header #nav .menu_list p {
padding: 0.14rem .3rem;
}
header #nav a.list,
header #nav a.list:hover,
header #nav a.list:active
{
color:inherit;
text-decoration: none;
}
.bannernew .content {
padding: 1.8rem .4rem;
}
......
......@@ -4,29 +4,29 @@ function getList(val) {
case "menu":
$("#nav").slideToggle("slow");
break;
case "secondMenu":
$("#second_menu").slideToggle("slow");
// $('.second_menu i').eq(0).addClass('down')
default:
//$(".menu_list").slideUp("slow");
$(val).slideToggle("slow");
break;
}
$('#mask').css({
"display": "block"
})
});
}
// 关闭二级菜单
function hideNav() {
$("#nav").slideUp("slow");
$("#second_menu").slideUp("slow");
$(".menu_list").slideUp("slow");
$('#mask').css({
"display": "none"
})
});
}
// 二级菜单每项点击后并将其隐藏
$('#nav .list').each(function () {
$(this).on("click", function () {
hideNav()
hideNav();
})
})
......@@ -35,23 +35,6 @@ $('#nav .list').each(function () {
$(window).scroll(function () {
var scrollTop = $(window).scrollTop();
if (scrollTop > 50) {
hideNav()
hideNav();
}
});
var a = 0;
function changeLangauge() {
var link = document.getElementsByTagName('link')[0]
if (a % 2) {
var link = document.createElement("link");
link.href = "/css/style_zh.css";
link.type = "text/css";
link.rel = "stylesheet";
document.head.appendChild(link);
} else {
link.href = window.location.href + 'css/common.css'
}
a++;
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册