Difference between revisions of "Team:NUDT CHINA"

Line 19: Line 19:
 
contentAuto();
 
contentAuto();
 
mouseWheel();
 
mouseWheel();
 +
touchMove();
 
bindNav();
 
bindNav();
 
add1();
 
add1();
Line 32: Line 33:
 
if(oContent.addEventListener){
 
if(oContent.addEventListener){
 
oContent.addEventListener('DOMMouseScroll',function(ev){
 
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 touchMove(){
 +
var bBtn = true;
 +
var timer = null;
 +
if(oContent.addEventListener){
 +
oContent.addEventListener('touchmove',function(ev){
 
var ev = ev || window.event;
 
var ev = ev || window.event;
 
clearTimeout(timer);
 
clearTimeout(timer);
Line 167: Line 223:
 
#lay-menu li.active{ background:black; cursor:default;}
 
#lay-menu li.active{ background:black; cursor:default;}
  
.myheader img{width:100%; margin: 0 auto;left:0;max-height:100%;
+
.myheader img{width:100%; margin: 0;position: absolute;  top: 50%;transform: translate(0, -50%)}
position: absolute;   
+
  top: 50%;
+
  transform: translate(0, -50%)}
+
 
#loading div{ width:100%; height:50%; position:absolute; left:0; background:#009ee0; z-index:50; transition:1s;text-align: center;}
 
#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(1){ top:0;}
Line 192: Line 245:
 
@media (max-width: 45em) {
 
@media (max-width: 45em) {
 
   .myheader {
 
   .myheader {
         width: 100%;}
+
         width: 10%;}
 
}
 
}
  

Revision as of 10:45, 25 October 2017

Team:NUDT_CHINA