Difference between revisions of "Team:NUDT CHINA"

 
(243 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{NUDT_CHINA}}
 
<html lang="en">
 
<html lang="en">
 
<head>
 
<head>
 
     <meta charset="utf-8">
 
     <meta charset="utf-8">
 
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
 
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <meta name="description" content="A layout example with a side menu that hides on mobile, just like the Pure website.">
+
     <title>Team:NUDT_CHINA</title>
    <title>Responsive Side Menu &ndash; Layout Examples &ndash; Pure</title>
+
<script type="text/javascript" >
   
+
window.onload=function(){
   
+
var oContent = $('content');
   
+
var oLoading = $('loading');
   
+
var oList = $('Qidilist');
        <!--[if lte IE 8]>
+
var aLiList = getByClass( oList , 'liList' );
            <link rel="stylesheet" href="/combo/1.18.13?/css/layouts/side-menu-old-ie.css">
+
var oMenu = $('lay-menu');
        <![endif]-->
+
  var oNextBtn=$('next-button');
        <!--[if gt IE 8]><!-->
+
var aLiMenu = oMenu.getElementsByTagName('li');
<style type="text/css">
+
var iNow = 0;
.pure-button:focus,a:active,a:hover{outline:0}.pure-table,table{border-collapse:collapse;border-spacing:0}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}abbr[title]{border-bottom:1px dotted}b,optgroup,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{box-sizing:content-box;height:0}pre,textarea{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}.pure-button,input{line-height:normal}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;box-sizing:content-box}.pure-button,.pure-form input:not([type]),.pure-menu{box-sizing:border-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend,td,th{padding:0}legend{border:0}.hidden,[hidden]{display:none!important}.pure-img{max-width:100%;height:auto;display:block}.pure-g{letter-spacing:-.31em;text-rendering:optimizespeed;font-family:FreeSans,Arimo,"Droid Sans",Helvetica,Arial,sans-serif;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-flow:row wrap;-ms-flex-flow:row wrap;flex-flow:row wrap;-webkit-align-content:flex-start;-ms-flex-line-pack:start;align-content:flex-start}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){table .pure-g{display:block}}.opera-only :-o-prefocus,.pure-g{word-spacing:-.43em}.pure-u,.pure-u-1,.pure-u-1-1,.pure-u-1-12,.pure-u-1-2,.pure-u-1-24,.pure-u-1-3,.pure-u-1-4,.pure-u-1-5,.pure-u-1-6,.pure-u-1-8,.pure-u-10-24,.pure-u-11-12,.pure-u-11-24,.pure-u-12-24,.pure-u-13-24,.pure-u-14-24,.pure-u-15-24,.pure-u-16-24,.pure-u-17-24,.pure-u-18-24,.pure-u-19-24,.pure-u-2-24,.pure-u-2-3,.pure-u-2-5,.pure-u-20-24,.pure-u-21-24,.pure-u-22-24,.pure-u-23-24,.pure-u-24-24,.pure-u-3-24,.pure-u-3-4,.pure-u-3-5,.pure-u-3-8,.pure-u-4-24,.pure-u-4-5,.pure-u-5-12,.pure-u-5-24,.pure-u-5-5,.pure-u-5-6,.pure-u-5-8,.pure-u-6-24,.pure-u-7-12,.pure-u-7-24,.pure-u-7-8,.pure-u-8-24,.pure-u-9-24{letter-spacing:normal;word-spacing:normal;vertical-align:top;text-rendering:auto;display:inline-block;zoom:1}.pure-g [class*=pure-u]{font-family:sans-serif}.pure-u-1-24{width:4.1667%}.pure-u-1-12,.pure-u-2-24{width:8.3333%}.pure-u-1-8,.pure-u-3-24{width:12.5%}.pure-u-1-6,.pure-u-4-24{width:16.6667%}.pure-u-1-5{width:20%}.pure-u-5-24{width:20.8333%}.pure-u-1-4,.pure-u-6-24{width:25%}.pure-u-7-24{width:29.1667%}.pure-u-1-3,.pure-u-8-24{width:33.3333%}.pure-u-3-8,.pure-u-9-24{width:37.5%}.pure-u-2-5{width:40%}.pure-u-10-24,.pure-u-5-12{width:41.6667%}.pure-u-11-24{width:45.8333%}.pure-u-1-2,.pure-u-12-24{width:50%}.pure-u-13-24{width:54.1667%}.pure-u-14-24,.pure-u-7-12{width:58.3333%}.pure-u-3-5{width:60%}.pure-u-15-24,.pure-u-5-8{width:62.5%}.pure-u-16-24,.pure-u-2-3{width:66.6667%}.pure-u-17-24{width:70.8333%}.pure-u-18-24,.pure-u-3-4{width:75%}.pure-u-19-24{width:79.1667%}.pure-u-4-5{width:80%}.pure-u-20-24,.pure-u-5-6{width:83.3333%}.pure-u-21-24,.pure-u-7-8{width:87.5%}.pure-u-11-12,.pure-u-22-24{width:91.6667%}.pure-u-23-24{width:95.8333%}.pure-u-1,.pure-u-1-1,.pure-u-24-24,.pure-u-5-5{width:100%}.pure-button{display:inline-block;zoom:1;white-space:nowrap;vertical-align:middle;text-align:center;cursor:pointer;-webkit-user-drag:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.pure-button::-moz-focus-inner{padding:0;border:0}.pure-button-group{letter-spacing:-.31em;text-rendering:optimizespeed}.opera-only :-o-prefocus,.pure-button-group{word-spacing:-.43em}.pure-button{font-family:inherit;font-size:100%;padding:.5em 1em;color:#444;color:rgba(0,0,0,.8);border:1px solid #999;border:transparent;background-color:#E6E6E6;text-decoration:none;border-radius:2px}.pure-button-hover,.pure-button:focus,.pure-button:hover{filter:alpha(opacity=90);background-image:-webkit-linear-gradient(transparent,rgba(0,0,0,.05) 40%,rgba(0,0,0,.1));background-image:linear-gradient(transparent,rgba(0,0,0,.05) 40%,rgba(0,0,0,.1))}.pure-button-active,.pure-button:active{box-shadow:0 0 0 1px rgba(0,0,0,.15) inset,0 0 6px rgba(0,0,0,.2) inset;border-color:#000\9}.pure-button-disabled,.pure-button-disabled:active,.pure-button-disabled:focus,.pure-button-disabled:hover,.pure-button[disabled]{border:none;background-image:none;filter:alpha(opacity=40);opacity:.4;cursor:not-allowed;box-shadow:none;pointer-events:none}.pure-button-hidden{display:none}.pure-button-primary,.pure-button-selected,a.pure-button-primary,a.pure-button-selected{background-color:#0078e7;color:#fff}.pure-button-group .pure-button{letter-spacing:normal;word-spacing:normal;vertical-align:top;text-rendering:auto;margin:0;border-radius:0;border-right:1px solid #111;border-right:1px solid rgba(0,0,0,.2)}.pure-button-group .pure-button:first-child{border-top-left-radius:2px;border-bottom-left-radius:2px}.pure-button-group .pure-button:last-child{border-top-right-radius:2px;border-bottom-right-radius:2px;border-right:none}.pure-form input[type=password],.pure-form input[type=email],.pure-form input[type=url],.pure-form input[type=date],.pure-form input[type=month],.pure-form input[type=time],.pure-form input[type=datetime],.pure-form input[type=datetime-local],.pure-form input[type=week],.pure-form input[type=tel],.pure-form input[type=color],.pure-form input[type=number],.pure-form input[type=search],.pure-form input[type=text],.pure-form select,.pure-form textarea{padding:.5em .6em;display:inline-block;border:1px solid #ccc;box-shadow:inset 0 1px 3px #ddd;border-radius:4px;vertical-align:middle;box-sizing:border-box}.pure-form input:not([type]){padding:.5em .6em;display:inline-block;border:1px solid #ccc;box-shadow:inset 0 1px 3px #ddd;border-radius:4px}.pure-form input[type=color]{padding:.2em .5em}.pure-form input:not([type]):focus,.pure-form input[type=password]:focus,.pure-form input[type=email]:focus,.pure-form input[type=url]:focus,.pure-form input[type=date]:focus,.pure-form input[type=month]:focus,.pure-form input[type=time]:focus,.pure-form input[type=datetime]:focus,.pure-form input[type=datetime-local]:focus,.pure-form input[type=week]:focus,.pure-form input[type=tel]:focus,.pure-form input[type=color]:focus,.pure-form input[type=number]:focus,.pure-form input[type=search]:focus,.pure-form input[type=text]:focus,.pure-form select:focus,.pure-form textarea:focus{outline:0;border-color:#129FEA}.pure-form input[type=file]:focus,.pure-form input[type=checkbox]:focus,.pure-form input[type=radio]:focus{outline:#129FEA auto 1px}.pure-form .pure-checkbox,.pure-form .pure-radio{margin:.5em 0;display:block}.pure-form input:not([type])[disabled],.pure-form input[type=password][disabled],.pure-form input[type=email][disabled],.pure-form input[type=url][disabled],.pure-form input[type=date][disabled],.pure-form input[type=month][disabled],.pure-form input[type=time][disabled],.pure-form input[type=datetime][disabled],.pure-form input[type=datetime-local][disabled],.pure-form input[type=week][disabled],.pure-form input[type=tel][disabled],.pure-form input[type=color][disabled],.pure-form input[type=number][disabled],.pure-form input[type=search][disabled],.pure-form input[type=text][disabled],.pure-form select[disabled],.pure-form textarea[disabled]{cursor:not-allowed;background-color:#eaeded;color:#cad2d3}.pure-form input[readonly],.pure-form select[readonly],.pure-form textarea[readonly]{background-color:#eee;color:#777;border-color:#ccc}.pure-form input:focus:invalid,.pure-form select:focus:invalid,.pure-form textarea:focus:invalid{color:#b94a48;border-color:#e9322d}.pure-form input[type=file]:focus:invalid:focus,.pure-form input[type=checkbox]:focus:invalid:focus,.pure-form input[type=radio]:focus:invalid:focus{outline-color:#e9322d}.pure-form select{height:2.25em;border:1px solid #ccc;background-color:#fff}.pure-form select[multiple]{height:auto}.pure-form label{margin:.5em 0 .2em}.pure-form fieldset{margin:0;padding:.35em 0 .75em;border:0}.pure-form legend{display:block;width:100%;padding:.3em 0;margin-bottom:.3em;color:#333;border-bottom:1px solid #e5e5e5}.pure-form-stacked input:not([type]),.pure-form-stacked input[type=password],.pure-form-stacked input[type=email],.pure-form-stacked input[type=url],.pure-form-stacked input[type=date],.pure-form-stacked input[type=month],.pure-form-stacked input[type=time],.pure-form-stacked input[type=datetime],.pure-form-stacked input[type=datetime-local],.pure-form-stacked input[type=week],.pure-form-stacked input[type=tel],.pure-form-stacked input[type=color],.pure-form-stacked input[type=file],.pure-form-stacked input[type=number],.pure-form-stacked input[type=search],.pure-form-stacked input[type=text],.pure-form-stacked label,.pure-form-stacked select,.pure-form-stacked textarea{display:block;margin:.25em 0}.pure-form-aligned .pure-help-inline,.pure-form-aligned input,.pure-form-aligned select,.pure-form-aligned textarea,.pure-form-message-inline{display:inline-block;vertical-align:middle}.pure-form-aligned textarea{vertical-align:top}.pure-form-aligned .pure-control-group{margin-bottom:.5em}.pure-form-aligned .pure-control-group label{text-align:right;display:inline-block;vertical-align:middle;width:10em;margin:0 1em 0 0}.pure-form-aligned .pure-controls{margin:1.5em 0 0 11em}.pure-form .pure-input-rounded,.pure-form input.pure-input-rounded{border-radius:2em;padding:.5em 1em}.pure-form .pure-group fieldset{margin-bottom:10px}.pure-form .pure-group input,.pure-form .pure-group textarea{display:block;padding:10px;margin:0 0 -1px;border-radius:0;position:relative;top:-1px}.pure-form .pure-group input:focus,.pure-form .pure-group textarea:focus{z-index:3}.pure-form .pure-group input:first-child,.pure-form .pure-group textarea:first-child{top:1px;border-radius:4px 4px 0 0;margin:0}.pure-form .pure-group input:first-child:last-child,.pure-form .pure-group textarea:first-child:last-child{top:1px;border-radius:4px;margin:0}.pure-form .pure-group input:last-child,.pure-form .pure-group textarea:last-child{top:-2px;border-radius:0 0 4px 4px;margin:0}.pure-form .pure-group button{margin:.35em 0}.pure-form .pure-input-1{width:100%}.pure-form .pure-input-3-4{width:75%}.pure-form .pure-input-2-3{width:66%}.pure-form .pure-input-1-2{width:50%}.pure-form .pure-input-1-3{width:33%}.pure-form .pure-input-1-4{width:25%}.pure-form .pure-help-inline,.pure-form-message-inline{display:inline-block;padding-left:.3em;color:#666;vertical-align:middle;font-size:.875em}.pure-form-message{display:block;color:#666;font-size:.875em}@media only screen and (max-width :480px){.pure-form button[type=submit]{margin:.7em 0 0}.pure-form input:not([type]),.pure-form input[type=password],.pure-form input[type=email],.pure-form input[type=url],.pure-form input[type=date],.pure-form input[type=month],.pure-form input[type=time],.pure-form input[type=datetime],.pure-form input[type=datetime-local],.pure-form input[type=week],.pure-form input[type=tel],.pure-form input[type=color],.pure-form input[type=number],.pure-form input[type=search],.pure-form input[type=text],.pure-form label{margin-bottom:.3em;display:block}.pure-group input:not([type]),.pure-group input[type=password],.pure-group input[type=email],.pure-group input[type=url],.pure-group input[type=date],.pure-group input[type=month],.pure-group input[type=time],.pure-group input[type=datetime],.pure-group input[type=datetime-local],.pure-group input[type=week],.pure-group input[type=tel],.pure-group input[type=color],.pure-group input[type=number],.pure-group input[type=search],.pure-group input[type=text]{margin-bottom:0}.pure-form-aligned .pure-control-group label{margin-bottom:.3em;text-align:left;display:block;width:100%}.pure-form-aligned .pure-controls{margin:1.5em 0 0}.pure-form .pure-help-inline,.pure-form-message,.pure-form-message-inline{display:block;font-size:.75em;padding:.2em 0 .8em}}.pure-menu-fixed{position:fixed;left:0;top:0;z-index:3}.pure-menu-item,.pure-menu-list{position:relative}.pure-menu-list{list-style:none;margin:0;padding:0}.pure-menu-item{padding:0;margin:0;height:100%}.pure-menu-heading,.pure-menu-link{display:block;text-decoration:none;white-space:nowrap}.pure-menu-horizontal{width:100%;white-space:nowrap}.pure-menu-horizontal .pure-menu-list{display:inline-block}.pure-menu-horizontal .pure-menu-heading,.pure-menu-horizontal .pure-menu-item,.pure-menu-horizontal .pure-menu-separator{display:inline-block;zoom:1;vertical-align:middle}.pure-menu-item .pure-menu-item{display:block}.pure-menu-children{display:none;position:absolute;left:100%;top:0;margin:0;padding:0;z-index:3}.pure-menu-horizontal .pure-menu-children{left:0;top:auto;width:inherit}.pure-menu-active>.pure-menu-children,.pure-menu-allow-hover:hover>.pure-menu-children{display:block;position:absolute}.pure-menu-has-children>.pure-menu-link:after{padding-left:.5em;content:"\25B8";font-size:small}.pure-menu-horizontal .pure-menu-has-children>.pure-menu-link:after{content:"\25BE"}.pure-menu-scrollable{overflow-y:scroll;overflow-x:hidden}.pure-menu-scrollable .pure-menu-list{display:block}.pure-menu-horizontal.pure-menu-scrollable .pure-menu-list{display:inline-block}.pure-menu-horizontal.pure-menu-scrollable{white-space:nowrap;overflow-y:hidden;overflow-x:auto;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;padding:.5em 0}.pure-menu-horizontal.pure-menu-scrollable::-webkit-scrollbar{display:none}.pure-menu-horizontal .pure-menu-children .pure-menu-separator,.pure-menu-separator{background-color:#ccc;height:1px;margin:.3em 0}.pure-menu-horizontal .pure-menu-separator{width:1px;height:1.3em;margin:0 .3em}.pure-menu-horizontal .pure-menu-children .pure-menu-separator{display:block;width:auto}.pure-menu-heading{text-transform:uppercase;color:#565d64}.pure-menu-link{color:#777}.pure-menu-children{background-color:#fff}.pure-menu-disabled,.pure-menu-heading,.pure-menu-link{padding:.5em 1em}.pure-menu-disabled{opacity:.5}.pure-menu-disabled .pure-menu-link:hover{background-color:transparent}.pure-menu-active>.pure-menu-link,.pure-menu-link:focus,.pure-menu-link:hover{background-color:#eee}.pure-menu-selected .pure-menu-link,.pure-menu-selected .pure-menu-link:visited{color:#000}.pure-table{empty-cells:show;border:1px solid #cbcbcb}.pure-table caption{color:#000;font:italic 85%/1 arial,sans-serif;padding:1em 0;text-align:center}.pure-table td,.pure-table th{border-left:1px solid #cbcbcb;border-width:0 0 0 1px;font-size:inherit;margin:0;overflow:visible;padding:.5em 1em}.pure-table td:first-child,.pure-table th:first-child{border-left-width:0}.pure-table thead{background-color:#e0e0e0;color:#000;text-align:left;vertical-align:bottom}.pure-table td{background-color:transparent}.pure-table-odd td,.pure-table-striped tr:nth-child(2n-1) td{background-color:#f2f2f2}.pure-table-bordered td{border-bottom:1px solid #cbcbcb}.pure-table-bordered tbody>tr:last-child>td{border-bottom-width:0}.pure-table-horizontal td,.pure-table-horizontal th{border-width:0 0 1px;border-bottom:1px solid #cbcbcb}.pure-table-horizontal tbody>tr:last-child>td{border-bottom-width:0}
+
var prevIndex = 0;
</style>
+
var iContentHeight = 0;
            <style type="text/css">
+
var btn1 = $('btn1');
<!--
+
var btn2 = $('btn2');
.pure-menu-item .pure-menu-item {
+
var btn3 = $('btn3');
    display: block;
+
var btn4 = $('btn4');
}
+
contentAuto();
 +
mouseWheel();
 +
bindNav();
 +
add1();
 +
add2();
 +
window.onresize = fnResize; 
 +
function add1() {
 +
oNextBtn.onclick=function () {
 +
showLoading();
 +
};
 +
}
 +
function add2() {
 +
btn1.onclick=function () {
 +
toMove(1);
 +
iNow=1;
 +
}
 +
btn2.onclick=function () {
 +
toMove(2);
 +
iNow=2;
 +
}
 +
btn3.onclick=function () {
 +
toMove(3);
 +
iNow=3;
 +
}
 +
btn4.onclick=function () {
 +
toMove(0);
 +
iNow=0;
 +
}
 +
}
 +
function mouseWheel(){
 +
var bBtn = true;
 +
var timer = null;
 +
if(oContent.addEventListener){
 +
oContent.addEventListener('DOMMouseScroll',function(ev){
 +
var ev = ev || window.event;
 +
clearTimeout(timer);
 +
timer = setTimeout(function(){
 +
toChange(ev);
 +
},200);
 +
},false);
 +
}
 +
oContent.onmousewheel = function(ev){
 +
var ev = ev || window.event;
 +
clearTimeout(timer);
 +
timer = setTimeout(function(){
 +
toChange(ev);
 +
},200);
 +
};
 +
 +
function toChange(ev){
 +
if(ev.detail){
 +
bBtn = ev.detail > 0 ? true : false;
 +
}
 +
else{
 +
bBtn = ev.wheelDelta < 0 ? true : false;
 +
}
 +
 +
if(  iNow == aLiList.length-1){if(bBtn!=0){return;};}
 +
if( iNow == 0 ){if(bBtn==0){return;};}
 +
 +
prevIndex = iNow;
 +
if(bBtn){  //
 +
if(iNow != aLiList.length-1){
 +
iNow++;
 +
}
 +
toMove(iNow);
 +
}
 +
else{  //↑
 +
if(iNow != 0){
 +
iNow--;
 +
}
 +
toMove(iNow);
 +
}
 +
 +
if(ev.preventDefault){
 +
ev.preventDefault();
 +
}
 +
else{
 +
return false;
 +
}
 +
}
 +
 +
}
 +
function showLoading(){
 +
var oSpan = oLoading.getElementsByTagName('span')[0];
 +
var aDiv = oLoading.getElementsByTagName('div');
 +
oSpan.style.width = '100%';
 +
oSpan.addEventListener('webkitTransitionend',spanChange,false);
 +
oSpan.addEventListener('transitionend',spanChange,false);
 +
function spanChange(){
 +
if(oSpan.style.width == '100%'){
 +
oSpan.style.display = 'none';
 +
aDiv[0].style.height = 0;
 +
aDiv[1].style.height = 0;
 +
}
 +
}
 +
aDiv[0].addEventListener('webkitTransitionend',divChange,false);
 +
aDiv[0].addEventListener('transitionend',divChange,false);
 +
 +
function divChange(){
 +
oLoading.parentNode.removeChild(oLoading);
 +
}
 +
 +
}
  
.pure-menu-children {
+
function bindNav(){
    display: none;
+
for(var i=0;i<aLiMenu.length;i++){
    position: absolute;
+
aLiMenu[i].index = i;
    left: 100%;
+
aLiMenu[i].onclick = function(){
    top: 0;
+
prevIndex = iNow;
    margin: 0;
+
iNow = this.index;
    padding: 0;
+
toMove( this.index );
    z-index: 3;
+
};
 +
}
 +
}
 +
function toMove(index){
 +
oList.style.top = - index * iContentHeight + 'px';
 +
for(var i=0;i<aLiMenu.length;i++){
 +
aLiMenu[i].className = '';
 +
}
 +
aLiMenu[index].className = 'active';
 +
}
 +
 +
function contentAuto(){
 +
iContentHeight = viewHeight() ;
 +
oContent.style.height = iContentHeight + 'px';
 +
for(var i=0;i<aLiList.length;i++){
 +
aLiList[i].style.height = iContentHeight + 'px';
 +
}
 +
oList.style.top = - iNow * iContentHeight + 'px';
 +
}
 +
 +
function fnResize(){
 +
contentAuto();
 +
}
 +
 +
function $(id){
 +
return document.getElementById(id);
 +
}
 +
 +
function viewWidth(){
 +
return window.innerWidth || document.documentElement.clientWidth;
 +
}
 +
 +
function viewHeight(){
 +
return window.innerHeight || document.documentElement.clientHeight;
 +
}
 +
 +
function getByClass(oParent,sClass){
 +
var aElem = oParent.getElementsByTagName('*');
 +
var arr = [];
 +
for(var i=0;i<aElem.length;i++){
 +
if( aElem[i].className == sClass ){
 +
arr.push( aElem[i] );
 +
}
 +
}
 +
return arr;
 +
}
 
}
 
}
 
+
</script>
.pure-menu-horizontal .pure-menu-children {
+
<style type="text/css">
    left: 0;
+
.button-next{    font-weight: bold;
     top: auto;
+
     font-family: "Lucida Console","Lucida Sans Typewriter",monaco,"Bitstream Vera Sans Mono",monospace;
    width: inherit;
+
}
+
 
+
.pure-menu-allow-hover:hover > .pure-menu-children,
+
.pure-menu-active > .pure-menu-children {
+
    display: block;
+
 
     position: absolute;
 
     position: absolute;
 +
    min-width: 180px;
 +
    min-height: 40px;
 +
  height: 7%;
 +
  width: 13%;
 +
  bottom: 1%;
 +
  background: #fff;
 +
  border: 1px solid #fff;
 +
  border-radius: 2px;
 +
  color: #222;
 +
  text-align: center;
 +
  cursor: pointer;
 +
  transition: .2s ease-in-out;
 +
  transform: translate(-50%, -50%);font-size: large;
 
}
 
}
 
+
.button-next:hover {
/* Vertical Menus - show the dropdown arrow */
+
  background: transparent;
.pure-menu-has-children > .pure-menu-link:after {
+
  color: #fff;
    padding-left: 0.5em;
+
    content: "\25B8";
+
    font-size: small;
+
}
+
 
+
/* Horizontal Menus - show the dropdown arrow */
+
.pure-menu-horizontal .pure-menu-has-children > .pure-menu-link:after {
+
    content: "\25BE";
+
 
}
 
}
 +
.myheader{height: 100%; text-align: center; background-color: rgba(255,255,255,0);margin:0 auto;position: relative;}
 +
.content{width:100%;}
 +
li{ list-style:none;}
 +
#Qidilist{ width:100%; position:absolute; top:0; left:0; transition:.5s top;}
 +
#lay-menu{ position:fixed; right:0; top:50%; z-index:20;}
 +
#lay-menu li{ width:10px; height:10px; border-radius:50%; margin:10px; border:1px black solid; cursor:pointer;}
 +
#lay-menu li.active{ background:black; cursor:default;}
  
 +
.myheader img{width:100%; margin: 0;position: absolute;  top: 50%;transform: translate(0, -50%); left: 0;max-height: 80%;}
 +
.myheader h1{width:100%; margin: 0;position: absolute;  top: 40%;transform: translate(0, -50%); left: 0;max-height: 80%;font-size:78px; font-family:"Comic Sans MS",cursive;border-bottom: none;padding-bottom:40px;line-height:normal;}
 +
.myheader h3{width:100%; margin: 0;position: absolute;  top: 60%;transform: translate(0, -50%); left: 0;max-height: 80%;font-size:30px;border-bottom: none;font-weight:initial;font-family: "Big Caslon","Book Antiqua","Palatino Linotype",Georgia,serif;line-height:normal;}
 +
#loading div{ width:100%; height:50%; position:absolute; left:0; background:#009ee0; z-index:50; transition:1s;text-align: center;}
 +
#loading div:nth-of-type(1){ top:0;}
 +
#loading div:nth-of-type(2){ bottom:0;}
 +
#loading span{ width:0%; height:4px; background:white; position:absolute; left:0; top:50%; margin-top:-2px; z-index:60; transition:.10s;}
 
body {
 
body {
 
     color: #777;
 
     color: #777;
 
}
 
}
 
+
#Qidilist .liList{ width:100%; position:relative;  overflow:hidden;text-align: center;left:-30px;}
.pure-img-responsive {
+
.big-bg{position:absolute; top:0;left:0;height:100%;width:100%; z-index:9;}
    max-width: 100%;
+
@media (min-width: 92em) {
    height: auto;
+
  .myheader {
 +
        width: 85%;}
 
}
 
}
 
+
@media (max-width: 92em) {
/*
+
  .myheader {
Add transition to containers so they can push in and out.
+
        width: 85%;}
*/
+
#layout,
+
#menu,
+
.menu-link {
+
    -webkit-transition: all 0.2s ease-out;
+
    -moz-transition: all 0.2s ease-out;
+
    -ms-transition: all 0.2s ease-out;
+
    -o-transition: all 0.2s ease-out;
+
    transition: all 0.2s ease-out;
+
 
}
 
}
 
+
@media (max-width: 45em) {
/*
+
  .myheader {
This is the parent `<div>` that contains the menu and the content area.
+
        width: 100%;}
*/
+
#layout {
+
    position: relative;
+
    left: 0;
+
    padding-left: 0;
+
 
}
 
}
    #layout.active #menu {
 
        left: 150px;
 
        width: 150px;
 
    }
 
  
    #layout.active .menu-link {
+
.next-button {z-index:10;position:absolute;font-weight: bold;
        left: 150px;
+
     font-family: "Lucida Console","Lucida Sans Typewriter",monaco,"Bitstream Vera Sans Mono",monospace;
     }
+
  top: 40%;
/*
+
  left: 50%;font-size:29px;font-weight:10px;
The content `<div>` is where all your content goes.
+
  z-index: 10;
*/
+
  padding: 1em 2.5em;
.content {
+
  background: #fff;
    margin: 0 auto;
+
  border: 1px solid #fff;
    padding: 0 2em;
+
  border-radius: 4px;
    max-width: 800px;
+
  color: #222;
    margin-bottom: 50px;
+
  font-size: large;
    line-height: 1.6em;
+
  text-align: center;
 +
  cursor: pointer;
 +
  transition: .2s ease-in-out;
 +
  transform: translate(-50%, -50%);}
 +
.next-button:hover {
 +
  background: transparent;
 +
  color: #fff;
 
}
 
}
 +
.under-bg{z-index: 0.5;opacity: 1; position: fixed; top: 0; left: 0; width: 100%; height: 100%;}
 +
</style>
  
.header {
 
    margin: 0;
 
    color: #333;
 
    text-align: center;
 
    padding: 2.5em 2em 0;
 
    border-bottom: 1px solid #eee;
 
}
 
    .header h1 {
 
        margin: 0.2em 0;
 
        font-size: 3em;
 
        font-weight: 300;
 
    }
 
    .header h2 {
 
        font-weight: 300;
 
        color: #ccc;
 
        padding: 0;
 
        margin-top: 0;
 
    }
 
 
.content-subhead {
 
    margin: 50px 0 20px 0;
 
    font-weight: 300;
 
    color: #888;
 
}
 
 
 
 
/*
 
The `#menu` `<div>` is the parent `<div>` that contains the `.pure-menu` that
 
appears on the left side of the page.
 
*/
 
 
#menu {
 
    margin-left: -150px; /* "#menu" width */
 
    width: 150px;
 
    position: fixed;
 
    top: 0;
 
    left: 0;
 
    bottom: 0;
 
    z-index: 1000; /* so the menu or its navicon stays above all content */
 
    background: #191818;
 
    overflow-y: auto;
 
    -webkit-overflow-scrolling: touch;
 
}
 
    /*
 
    All anchors inside the menu should be styled like this.
 
    */
 
    #menu a {
 
        color: #999;
 
        border: none;
 
        padding: 0.6em 0 0.6em 0.6em;
 
    }
 
 
    /*
 
    Remove all background/borders, since we are applying them to #menu.
 
    */
 
    #menu .pure-menu,
 
    #menu .pure-menu ul {
 
        border: none;
 
        background: transparent;
 
    }
 
 
    /*
 
    Add that light border to separate items into groups.
 
    */
 
    #menu .pure-menu ul,
 
    #menu .pure-menu .menu-item-divided {
 
        border-top: 1px solid #333;
 
    }
 
        /*
 
        Change color of the anchor links on hover/focus.
 
        */
 
        #menu .pure-menu li a:hover,
 
        #menu .pure-menu li a:focus {
 
            background: #333;
 
        }
 
 
    /*
 
    This styles the selected menu item `<li>`.
 
    */
 
    #menu .pure-menu-selected,
 
    #menu .pure-menu-heading {
 
        background: #1f8dd6;
 
    }
 
        /*
 
        This styles a link within a selected menu item `<li>`.
 
        */
 
        #menu .pure-menu-selected a {
 
            color: #fff;
 
        }
 
 
    /*
 
    This styles the menu heading.
 
    */
 
    #menu .pure-menu-heading {
 
        font-size: 110%;
 
        color: #fff;
 
        margin: 0;
 
    }
 
 
/* -- Dynamic Button For Responsive Menu -------------------------------------*/
 
 
/*
 
The button to open/close the Menu is custom-made and not part of Pure. Here's
 
how it works:
 
*/
 
 
/*
 
`.menu-link` represents the responsive menu toggle that shows/hides on
 
small screens.
 
*/
 
.menu-link {
 
    position: fixed;
 
    display: block; /* show this only on small screens */
 
    top: 0;
 
    left: 0; /* "#menu width" */
 
    background: #000;
 
    background: rgba(0,0,0,0.7);
 
    font-size: 10px; /* change this value to increase/decrease button size */
 
    z-index: 10;
 
    width: 2em;
 
    height: auto;
 
    padding: 2.1em 1.6em;
 
}
 
 
    .menu-link:hover,
 
    .menu-link:focus {
 
        background: #000;
 
    }
 
 
    .menu-link span {
 
        position: relative;
 
        display: block;
 
    }
 
 
    .menu-link span,
 
    .menu-link span:before,
 
    .menu-link span:after {
 
        background-color: #fff;
 
        width: 100%;
 
        height: 0.2em;
 
    }
 
 
        .menu-link span:before,
 
        .menu-link span:after {
 
            position: absolute;
 
            margin-top: -0.6em;
 
            content: " ";
 
        }
 
 
        .menu-link span:after {
 
            margin-top: 0.6em;
 
        }
 
 
 
/* -- Responsive Styles (Media Queries) ------------------------------------- */
 
 
/*
 
Hides the menu at `48em`, but modify this based on your app's needs.
 
*/
 
@media (min-width: 48em) {
 
 
    .header,
 
    .content {
 
        padding-left: 2em;
 
        padding-right: 2em;
 
    }
 
 
    #layout {
 
        padding-left: 150px; /* left col width "#menu" */
 
        left: 0;
 
    }
 
    #menu {
 
        left: 150px;
 
    }
 
 
    .menu-link {
 
        position: fixed;
 
        left: 150px;
 
        display: none;
 
    }
 
 
    #layout.active .menu-link {
 
        left: 150px;
 
    }
 
}
 
 
@media (max-width: 48em) {
 
    /* Only apply this when the window is small. Otherwise, the following
 
    case results in extra padding on the left:
 
        * Make the window small.
 
        * Tap the menu to trigger the active state.
 
        * Make the window large again.
 
    */
 
    #layout.active {
 
        position: relative;
 
        left: 150px;
 
    }
 
}
 
-->
 
            </style>
 
        <!--<![endif]-->
 
    <!--[if lt IE 9]>
 
        <script src="http://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7/html5shiv.js"></script>
 
    <![endif]-->
 
    <script>
 
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
 
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
 
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
 
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
 
   
 
    ga('create', 'UA-41480445-1', 'purecss.io');
 
    ga('send', 'pageview');
 
    </script>
 
 
</head>
 
</head>
<body>
+
<img class="under-bg" src="https://static.igem.org/mediawiki/2017/c/cc/T-NUDT_CHINA-MainPage1.jpg" alt="">
 
+
<div id="loading">
 
+
    <div><img src="https://static.igem.org/mediawiki/2017/1/17/T-NUDT_CHINA-loadingBg3.jpg" alt="" class="big-bg"></div>
 
+
        <div><img src="https://static.igem.org/mediawiki/2017/a/ab/T-NUDT_CHINA-loadingBg4.jpg" alt="" class="big-bg">
 
+
            <a class="next-button" id="next-button">Get Started!</a>
 
+
        </div>
 
+
<div id="layout">
+
    <!-- Menu toggle -->
+
    <a href="#menu" id="menuLink" class="menu-link">
+
        <!-- Hamburger icon -->
+
 
         <span></span>
 
         <span></span>
     </a>
+
     </div>
 
+
 
    <div id="menu">
+
  <div id="layout">
         <div class="pure-menu">
+
         <a href="#menu" id="menuLink" class="menu-link">
             <img class="pure-img-responsive" src="http://farm8.staticflickr.com/7357/9086701425_fda3024927.jpg" alt="Mountain">
+
             <span></span>
            <!--<a class="pure-menu-heading" href="#">Company</a>-->
+
        </a>
            <div class="custom-restricted-width">
+
        <div id="menu">
            <ul class="pure-menu-list">
+
        <div class="pure-menu"><img src="https://static.igem.org/mediawiki/2017/4/4f/T-NUDT_CHINA-icon01.png" width=240px height=190px alt="">
                 <li class="pure-menu-item pure-menu-selected"><a href="#" class="pure-menu-link">Home</a></li>
+
          <ul class="pure-menu-list">
                 <li class="pure-menu-item"><a href="#" class="pure-menu-link">About</a></li>
+
            <li class="pure-menu-item"><a class="pure-menu-heading" href="https://2017.igem.org/Team:NUDT_CHINA" class="pure-menu-link">HOME</a></li>             
 
+
         
                <li class="pure-menu-item" class="menu-item-divided pure-menu-selected">
+
            <li class="pure-menu-item pure-menu-has-children">
                    <a href="#" class="pure-menu-link">Services</a>
+
              <class="pure-menu-link"onclick="Show('team_show')">TEAM</a>
                 </li>
+
              <ul class="pure-menu-children" id="team_show">
 
+
                 <li class="pure-menu-item"><a href="https://2017.igem.org/Team:NUDT_CHINA/Team" class="pure-menu-link">Team</a></li>
                 <li class="pure-menu-item"><a href="#" class="pure-menu-link">Contact</a></li>
+
                 <li class="pure-menu-item"><a href="https://2017.igem.org/Team:NUDT_CHINA/Collaborations" class="pure-menu-link">Collaborations</a></li>
                 <li class="pure-menu-item pure-menu-has-children pure-menu-allow-hover">
+
            </ul>
                  <a href="#" id="menuLink1" class="pure-menu-link">More</a>
+
            </li>
                  <ul class="pure-menu-children">
+
            <li class="pure-menu-item pure-menu-has-children">
                      <li class="pure-menu-item"><a href="#" class="pure-menu-link">Autos</a></li>
+
              <a  class="pure-menu-link"onclick="Show('project_show')">PROJECT</a>
                      <li class="pure-menu-item"><a href="#" class="pure-menu-link">Flickr</a></li>
+
              <ul class="pure-menu-children" id="project_show">
                      <li class="pure-menu-item pure-menu-has-children pure-menu-allow-hover">
+
                <li class="pure-menu-item"><a href="https://2017.igem.org/Team:NUDT_CHINA/Description" class="pure-menu-link">Description</a></li>
                          <a href="#" id="menuLink1" class="pure-menu-link">Even More</a>
+
                 <li class="pure-menu-item"><a href="https://2017.igem.org/Team:NUDT_CHINA/Design" class="pure-menu-link">Design</a></li>
                          <ul class="pure-menu-children">
+
                 <li class="pure-menu-item"><a href="https://2017.igem.org/Team:NUDT_CHINA/Experiments" class="pure-menu-link">Experiment</a></li>
                            <li class="pure-menu-item"><a href="#" class="pure-menu-link">Foo</a></li>
+
                 <li class="pure-menu-item"><a href="https://2017.igem.org/Team:NUDT_CHINA/Notebook" class="pure-menu-link">Notebook</a></li>
                            <li class="pure-menu-item"><a href="#" class="pure-menu-link">Bar</a></li>
+
                <li class="pure-menu-item"><a href="https://2017.igem.org/Team:NUDT_CHINA/Results" class="pure-menu-link">Results</a></li>
                            <li class="pure-menu-item"><a href="#" class="pure-menu-link">Baz</a></li>
+
                <li class="pure-menu-item"><a href="https://2017.igem.org/Team:NUDT_CHINA/Demonstrate" class="pure-menu-link">Demonstrate</a></li>
                          </ul>
+
                <li class="pure-menu-item"><a href="https://2017.igem.org/Team:NUDT_CHINA/Improve" class="pure-menu-link">Improve</a></li>
                      </li>
+
            </ul>
                  </ul>
+
            </li>
                </li>
+
            <li class="pure-menu-item pure-menu-has-children">
 +
              <a  class="pure-menu-link"onclick="Show('part_show')">PARTS</a>
 +
              <ul class="pure-menu-children" id="part_show">
 +
                <li class="pure-menu-item"><a href="https://2017.igem.org/Team:NUDT_CHINA/Parts" class="pure-menu-link">Parts</a></li>
 +
                <li class="pure-menu-item"><a href="https://2017.igem.org/Team:NUDT_CHINA/Basic_Part" class="pure-menu-link">Basic Parts</a></li>
 +
                <li class="pure-menu-item"><a href="https://2017.igem.org/Team:NUDT_CHINA/Composite_Part" class="pure-menu-link">Composite Parts</a></li>
 +
                <li class="pure-menu-item"><a href="https://2017.igem.org/Team:NUDT_CHINA/Part_Collection" class="pure-menu-link">Part Collection</a></li>
 +
            </ul>
 +
            </li>
 +
                <li class="pure-menu-item"><a href="https://2017.igem.org/Team:NUDT_CHINA/Attributions" class="pure-menu-link">Attributions</a></li>
 +
                <li class="pure-menu-item"><a href="https://2017.igem.org/Team:NUDT_CHINA/InterLab" class="pure-menu-link">InterLab</a></li>
 +
                <li class="pure-menu-item"><a href="https://2017.igem.org/Team:NUDT_CHINA/Model" class="pure-menu-link">Model</a></li>
 +
                <li class="pure-menu-item"><a href="https://2017.igem.org/Team:NUDT_CHINA/Safety" class="pure-menu-link">SAFETY</a></li>
 +
            <li class="pure-menu-item pure-menu-has-children">
 +
              <a  class="pure-menu-link"onclick="Show('HP_show')">HP</a>
 +
              <ul class="pure-menu-children" id="HP_show">
 +
                <li class="pure-menu-item"><a href="https://2017.igem.org/Team:NUDT_CHINA/HP/Silver" class="pure-menu-link">Silver HP</a></li>
 +
                <li class="pure-menu-item"><a href="https://2017.igem.org/Team:NUDT_CHINA/HP/Gold_Integrated" class="pure-menu-link">Integrated & Gold</a></li>
 +
                <li class="pure-menu-item"><a href="https://2017.igem.org/Team:NUDT_CHINA/Engagement" class="pure-menu-link">Public Engagement</a></li>
 +
            </ul>
 +
            </li>
 
             </ul>
 
             </ul>
 +
        </div> 
 
         </div>
 
         </div>
 +
        <div id="content" class="content">
 +
    <ul id="lay-menu">
 +
        <li class="active"></li>
 +
            <li></li>
 +
            <li></li>
 +
            <li></li>
 +
        </ul>
 +
    <ul id="Qidilist">
 +
      <li id="abstract" class="liList">
 +
            <div class="myheader"id="main"><h1>MiRNA &nbsp;&nbsp;Locker</h1><h3>A Modularized DNA Assembly As miRNA Inhibitors</h3><button id="btn1" class="button-next">How it works?</button></div>
 +
            </li>
 +
      <li id="abstract" class="liList">
 +
            <div class="myheader"id="main"><img class="strory-telling1" src="https://static.igem.org/mediawiki/2017/a/ad/T-NUDT_CHINA-story1.png" no-repeat; ><button id="btn2" class="button-next">Next</button></div>
 +
            </li>
 +
      <li id="abstract" class="liList">
 +
            <div class="myheader"id="main"><img class="strory-telling2" src="https://static.igem.org/mediawiki/2017/3/35/T-NUDT_CHINA-story2.png" no-repeat; ><button id="btn3" class="button-next">Next</button></div>
 +
            </li>
 +
      <li id="abstract" class="liList">
 +
            <div class="myheader"id="main"><img class="strory-telling3" src="https://static.igem.org/mediawiki/2017/1/1e/T-NUDT_CHINA-story3.png" no-repeat; ><button id="btn4" class="button-next">Back</button></div>
 +
            </li>
 +
   
 +
        </ul>
 
         </div>
 
         </div>
    </div>
+
          
 
+
    <div id="main">
+
         <div class="header">
+
            <h1>Page Title</h1>
+
            <h2>A subtitle for your page goes here</h2>
+
        </div>
+
 
+
        <div class="content">
+
            <h2 class="content-subhead">How to use this layout</h2>
+
            <p>
+
                To use this layout, you can just copy paste the HTML, along with the CSS in <a href="/css/layouts/side-menu.css" alt="Side Menu CSS">side-menu.css</a>, and the JavaScript in <a href="/js/ui.js">ui.js</a>. The JS file uses vanilla JavaScript to simply toggle an <code>active</code> class that makes the menu responsive.
+
            </p>
+
 
+
            <h2 class="content-subhead">Now Let's Speak Some Latin</h2>
+
            <p>
+
                Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+
            </p>
+
 
+
            <div class="pure-g">
+
                <div class="pure-u-1-4">
+
                    <img class="pure-img-responsive" src="http://farm3.staticflickr.com/2875/9069037713_1752f5daeb.jpg" alt="Peyto Lake">
+
                </div>
+
                <div class="pure-u-1-4">
+
                    <img class="pure-img-responsive" src="http://farm3.staticflickr.com/2813/9069585985_80da8db54f.jpg" alt="Train">
+
                </div>
+
                <div class="pure-u-1-4">
+
                    <img class="pure-img-responsive" src="http://farm6.staticflickr.com/5456/9121446012_c1640e42d0.jpg" alt="T-Shirt Store">
+
                </div>
+
                <div class="pure-u-1-4">
+
                    <img class="pure-img-responsive" src="http://farm8.staticflickr.com/7357/9086701425_fda3024927.jpg" alt="Mountain">
+
                </div>
+
            </div>
+
 
+
            <h2 class="content-subhead">Try Resizing your Browser</h2>
+
            <p>
+
                Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+
            </p>
+
        </div>
+
    </div>
+
 
</div>
 
</div>
 
+
<script type="text/javascript">
 
+
( function(window,document){
 
+
 
+
<script type="text/javascript" >
+
(function (window, document) {
+
  
 
     var layout  = document.getElementById('layout'),
 
     var layout  = document.getElementById('layout'),
Line 458: Line 392:
  
 
}(this, this.document));
 
}(this, this.document));
(function (window, document) {
+
</script>
    'use strict';
+
 
+
    // Enable drop-down menus in Pure
+
    // Inspired by YUI3 gallery-simple-menu by Julien LeComte
+
    // [https://github.com/yui/yui3-gallery/blob/master/src/gallery-simple-menu/js/simple-menu.js]
+
 
+
    function PureDropdown(dropdownParent) {
+
 
+
        var PREFIX = 'pure-',
+
            ACTIVE_CLASS_NAME = PREFIX + 'menu-active',
+
            ARIA_ROLE = 'role',
+
            ARIA_HIDDEN = 'aria-hidden',
+
            MENU_OPEN = 0,
+
            MENU_CLOSED = 1,
+
            MENU_PARENT_CLASS_NAME = 'pure-menu-has-children',
+
            MENU_ACTIVE_SELECTOR = '.pure-menu-active',
+
            MENU_LINK_SELECTOR = '.pure-menu-link',
+
            MENU_SELECTOR = '.pure-menu-children',
+
            DISMISS_EVENT = (window.hasOwnProperty &&
+
                window.hasOwnProperty('ontouchstart')) ?
+
                    'touchstart' : 'mousedown',
+
 
+
            ARROW_KEYS_ENABLED = true,
+
 
+
            ddm = this; // drop down menu
+
 
+
            this._state = MENU_CLOSED;
+
 
+
            this.show = function () {
+
                if (this._state !== MENU_OPEN) {
+
                    this._dropdownParent.classList.add(ACTIVE_CLASS_NAME);
+
                    this._menu.setAttribute(ARIA_HIDDEN, false);
+
                    this._state = MENU_OPEN;
+
                }
+
            };
+
 
+
            this.hide = function () {
+
                if (this._state !== MENU_CLOSED) {
+
                    this._dropdownParent.classList.remove(ACTIVE_CLASS_NAME);
+
                    this._menu.setAttribute(ARIA_HIDDEN, true);
+
                    this._link.focus();
+
                    this._state = MENU_CLOSED;
+
                }
+
            };
+
 
+
            this.toggle = function () {
+
                this[this._state === MENU_CLOSED ? 'show' : 'hide']();
+
            };
+
 
+
            this.halt = function (e) {
+
                e.stopPropagation();
+
                e.preventDefault();
+
            };
+
 
+
            this._dropdownParent = dropdownParent;
+
            this._link = this._dropdownParent.querySelector(MENU_LINK_SELECTOR);
+
            this._menu = this._dropdownParent.querySelector(MENU_SELECTOR);
+
            this._firstMenuLink = this._menu.querySelector(MENU_LINK_SELECTOR);
+
 
+
            // Set ARIA attributes
+
            this._link.setAttribute('aria-haspopup', 'true');
+
            this._menu.setAttribute(ARIA_ROLE, 'menu');
+
            this._menu.setAttribute('aria-labelledby', this._link.getAttribute('id'));
+
            this._menu.setAttribute('aria-hidden', 'true');
+
            [].forEach.call(
+
                this._menu.querySelectorAll('li'),
+
                function(el){
+
                    el.setAttribute(ARIA_ROLE, 'presentation');
+
                }
+
            );
+
            [].forEach.call(
+
                this._menu.querySelectorAll('a'),
+
                function(el){
+
                    el.setAttribute(ARIA_ROLE, 'menuitem');
+
                }
+
            );
+
 
+
            // Toggle on click
+
            this._link.addEventListener('click', function (e) {
+
                e.stopPropagation();
+
                e.preventDefault();
+
                ddm.toggle();
+
            });
+
 
+
            // Keyboard navigation
+
            document.addEventListener('keydown', function (e) {
+
                var currentLink,
+
                    previousSibling,
+
                    nextSibling,
+
                    previousLink,
+
                    nextLink;
+
 
+
                // if the menu isn't active, ignore
+
                if (ddm._state !== MENU_OPEN) {
+
                    return;
+
                }
+
 
+
                // if the menu is the parent of an open, active submenu, ignore
+
                if (ddm._menu.querySelector(MENU_ACTIVE_SELECTOR)) {
+
                    return;
+
                }
+
 
+
                currentLink = ddm._menu.querySelector(':focus');
+
 
+
                // Dismiss an open menu on ESC
+
                if (e.keyCode === 27) {
+
                    /* Esc */
+
                    ddm.halt(e);
+
                    ddm.hide();
+
                }
+
                // Go to the next link on down arrow
+
                else if (ARROW_KEYS_ENABLED && e.keyCode === 40) {
+
                    /* Down arrow */
+
                    ddm.halt(e);
+
                    // get the nextSibling (an LI) of the current link's LI
+
                    nextSibling = (currentLink) ? currentLink.parentNode.nextSibling : null;
+
                    // if the nextSibling is a text node (not an element), go to the next one
+
                    while (nextSibling && nextSibling.nodeType !== 1) {
+
                        nextSibling = nextSibling.nextSibling;
+
                    }
+
                    nextLink = (nextSibling) ? nextSibling.querySelector('.pure-menu-link') : null;
+
                    // if there is no currently focused link, focus the first one
+
                    if (!currentLink) {
+
                        ddm._menu.querySelector('.pure-menu-link').focus();
+
                    }
+
                    else if (nextLink) {
+
                        nextLink.focus();
+
                    }
+
                }
+
                // Go to the previous link on up arrow
+
                else if (ARROW_KEYS_ENABLED && e.keyCode === 38) {
+
                    /* Up arrow */
+
                    ddm.halt(e);
+
                    // get the currently focused link
+
                    previousSibling = (currentLink) ? currentLink.parentNode.previousSibling : null;
+
                    while (previousSibling && previousSibling.nodeType !== 1) {
+
                        previousSibling = previousSibling.previousSibling;
+
                    }
+
                    previousLink = (previousSibling) ? previousSibling.querySelector('.pure-menu-link') : null;
+
                    // if there is no currently focused link, focus the last link
+
                    if (!currentLink) {
+
                        ddm._menu.querySelector('.pure-menu-item:last-child .pure-menu-link').focus();
+
                    }
+
                    // else if there is a previous item, go to the previous item
+
                    else if (previousLink) {
+
                        previousLink.focus();
+
                    }
+
                }
+
            });
+
 
+
            // Dismiss an open menu on outside event
+
            document.addEventListener(DISMISS_EVENT, function (e) {
+
                var target = e.target;
+
                if (target !== ddm._link && !ddm._menu.contains(target)) {
+
                    ddm.hide();
+
                    ddm._link.blur();
+
                }
+
            });
+
  
 +
<script type="text/javascript" >
 +
    function Show(tagId) {
 +
    if (document.getElementById(tagId).style.display=="none") {
 +
    document.getElementById(tagId).style.display="block";
 +
   
 +
    }
 +
    else {
 +
    document.getElementById(tagId).style.display="none";
 
     }
 
     }
 
    function initDropdowns() {
 
        var dropdownParents = document.querySelectorAll('.pure-menu-has-children');
 
        for (var i = 0; i < dropdownParents.length; i++) {
 
            var ddm = new PureDropdown(dropdownParents[i]);
 
        }
 
 
     }
 
     }
 
    initDropdowns();
 
 
}(this, this.document));
 
 
 
</script>
 
</script>
 
 
</body>
 
</body>
 
</html>
 
</html>

Latest revision as of 02:17, 2 November 2017

Team:NUDT_CHINA