1
0
mirror of https://github.com/actix/actix-website synced 2024-11-27 18:12:57 +01:00

let nav i18n

This commit is contained in:
krircc 2018-06-24 10:00:12 +08:00
parent 1cd36888c2
commit ada7b80fe9
4 changed files with 42 additions and 7 deletions

View File

@ -26,7 +26,7 @@
</button> </button>
</div> </div>
<div class="navbar-collapse collapse" id="actix-main-nav"> <div class="navbar-collapse collapse" id="actix-main-nav">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav" id="ul-en">
<li class="nav-item hd-lg-down"> <li class="nav-item hd-lg-down">
<a class="navbar-brand" href="/"><img src="/img/logo-nav.png" class="align-middle" alt=""></a> <a class="navbar-brand" href="/"><img src="/img/logo-nav.png" class="align-middle" alt=""></a>
</li> </li>
@ -43,13 +43,37 @@
<a class="nav-link" href="/code/">Code</a> <a class="nav-link" href="/code/">Code</a>
</li> </li>
<li class="nav-item" id="language"> <li class="nav-item" id="language">
<div id="lang">EN</div> <img src="/img/i18n.jpeg"/>
<ul class="subitem"> <ul class="subitem">
<li class="submenu-item"><a href="https://actix.rs">English</a></li> <li class="submenu-item"><a href="https://actix.rs">English</a></li>
<li class="submenu-item"><a href="https://actix.rs/cn">中文</a> </li> <li class="submenu-item"><a href="https://actix.rs/cn">中文</a> </li>
</ul> </ul>
</li> </li>
</ul> </ul>
<ul class="nav navbar-nav" id="ul-zh">
<li class="nav-item hd-lg-down">
<a class="navbar-brand" href="/"><img src="/img/logo-nav.png" class="align-middle" alt=""></a>
</li>
<li class="nav-item">
<a class="nav-link" href="/">首页</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/docs/">文档</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/community/">社区</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/code/">源码</a>
</li>
<li class="nav-item" id="language">
<img src="/img/i18n.jpeg"/>
<ul class="subitem">
<li class="submenu-item"><a href="https://actix.rs">English</a></li>
<li class="submenu-item"><a href="https://actix.rs/cn">中文</a> </li>
</ul>
</li>
</ul>
</div> </div>
</nav> </nav>
</header> </header>

View File

@ -171,13 +171,17 @@ img {
padding-top: 0; padding-top: 0;
list-style: none; list-style: none;
} }
.navbar-nav #language img {
width: 25px;
height:22px;
}
.navbar-nav #language ul { .navbar-nav #language ul {
display: none; display: none;
} }
.navbar-nav #language:hover .subitem { .navbar-nav #language:hover .subitem {
margin: -1rem 0 0 -6.6rem; margin: -1rem 0 0 -6.6rem;
display: block; display: block;
background-color: #e8f9fc; background-color: #dcfaf7;
} }
.navbar-nav #language ul li { .navbar-nav #language ul li {
display: block; display: block;

BIN
static/img/i18n.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View File

@ -1,10 +1,17 @@
window.onload = function(){ window.onload = function(){
if (window.location.href.search("cn") != -1) { if (window.location.href.search("cn") != -1) {
var actix_home = document.getElementById("act-home") if (document.getElementById("act-home")){
actix_home.style.display = "none" document.getElementById("act-home").style.display = "none"
}
}else{ }else{
var actix_home_cn = document.getElementById("act-home-cn") if (document.getElementById("act-home-cn")){
actix_home_cn.style.display = "none" document.getElementById("act-home-cn").style.display = "none"
}
}
if (window.location.href.search("cn") != -1) {
document.getElementById("ul-en").style.display = "none"
}else{
document.getElementById("ul-zh").style.display = "none"
} }
} }