Difference between revisions of "Template:Team:TU Darmstadt/Viki"

Line 152: Line 152:
 
<!-- START JS and CSS for the Scrollbox -->
 
<!-- START JS and CSS for the Scrollbox -->
  
<script type="text/javascript">
+
<script type="text/javascript" src="https://2016.igem.org/Template:Team:TU_Darmstadt/Js?
$(window).scroll(function(e) {
+
action=raw&ctype=text/javascript"></script>
  var $element = $('.scrollbox');
+
  var headerHeight = $('#head').outerHeight();
+
  var isFixed = ($element.css('position') == 'fixed');
+
 
+
  if ($(this).scrollTop() > headerHeight) {
+
    if(!isFixed) {
+
        console.log('scroll');
+
        $element.addClass("scrolled");
+
    }
+
  }
+
  if ($(this).scrollTop() < headerHeight) {
+
    if(isFixed) {
+
        console.log('dont scroll');
+
        $element.removeClass("scrolled");
+
    }
+
  }
+
});
+
 
+
function scrollToTop() {
+
  $('body,html').animate({
+
    scrollTop: 0
+
  }, 400);
+
}
+
</script>
+
  
 
<style>
 
<style>

Revision as of 12:16, 12 October 2016