Difference between revisions of "Template:NCTU Formosa/test"

Line 1,228: Line 1,228:
 
     .menu2_bottom_padding {display:none;}
 
     .menu2_bottom_padding {display:none;}
 
     .menu2_button.direct_to_page { padding-left: 36px; }
 
     .menu2_button.direct_to_page { padding-left: 36px; }
 +
}
 +
 +
.top_button{
 +
  width: 5%;
 +
  cursor: pointer;
 +
  position: fixed;
 +
  right: 2%;
 +
  bottom: 30px;
 +
  display: none;
 +
  transition-duration: 0.4s;
 +
}
 +
 +
.top_button:hover{
 +
  transform: scale(1.2);
 
}
 
}
  
Line 1,603: Line 1,617:
 
     </div>
 
     </div>
 
</div>
 
</div>
 +
<img class="top_button" id="tb" src="https://static.igem.org/mediawiki/2018/e/e8/T--NCTU_Formosa--top.png">
 
</body>
 
</body>
  
Line 1,680: Line 1,695:
 
     });
 
     });
 
});
 
});
 
  
 
</script>
 
</script>
  
 +
<script type="text/javascript" src="http://gsgd.co.uk/sandbox/jquery/easing/jquery.easing.1.3.js"></script>
 +
<script>
 +
$(function(){
 +
$('.top_button').click(function(){
 +
  $('html, body').animate({
 +
scrollTop: 0
 +
}, 1500, "easeOutCirc");
 +
  return false;
 +
});
 +
});
 +
 +
/*$(window).bind('scroll',function(){
 +
                var len=$(this).scrollTop();
 +
                var a=document.elementById("tb");
 +
                if(len>=900){
 +
                    $('tb').fadeIn(500);
 +
                }else{
 +
                    $('tb').fadeOut(200);
 +
                }
 +
            });*/
 +
 +
window.onscroll = function() {
 +
var box = document.getElementById('tb');
 +
    var osTop = document.documentElement.scrollTop || document.body.scrollTop;
 +
    // console.log(osTop)
 +
    if (osTop>700) {
 +
    box.style.display = "block"
 +
    }
 +
    if (osTop<200) {
 +
    box.style.display = "none"
 +
    }
 +
}
 +
 +
</script>
 
</html>
 
</html>

Revision as of 05:21, 7 October 2018

Navigation Bar