Template:Bielefeld-CeBiTec/js/stylesheet

$(document).ready(function () { var shiftWindow = function() { scrollBy(0, -80) }; window.addEventListener("hashchange", shiftWindow); function load() { if (window.location.hash) shiftWindow(); } load(); });

$(document).ready(function(){

   $("#myNav").affix({
       offset: { 
           top: 195 
     }
   });

});

(document).ready(function() { $("#logo-cf").hover(function(){ $("#logo-cf img").animate({ opacity: 0 }, 'slow'); }, function() { $("#logo-cf img").animate({ opacity: 1 }, 'slow'); }); });

$('body').scrollspy({ target: '#pagenav' });

$(function(){

   var menuActive = false,
       touched = false,
       $nav = $('.nav');
   function removeActive(callback){
       $nav.find('.MenuActive').removeClass('MenuActive');
       callback();
   }
   function newActive($this,menu){
       removeActive(function(){
           $this.next().addClass('MenuActive').queue(function(){
               if(menu){
                   menuActive = true;
                   touched = false;
               } else {
                   touched = true;
               }
           }).dequeue();
       });   
   }
   $nav.on({
       touchstart:function(e){            
           e.stopPropagation();
           newActive($(this),touched);
       },
       mouseenter:function(){
           newActive($(this),true);  
       },
       click:function(e){
           e.preventDefault();
           if(menuActive){
               $(this).trigger('trueClick',e.target);
           }
       },
       trueClick:function(e,$target){
           $(this).parents('.nav').trigger('mouseleave');
           window.location.href = $target;
       }
   },'li .has_children').on('mouseleave',function(){
       removeActive(function(){
           menuActive = false;
           touched = false;
       });
   });
   $('html').on('touchstart',function(e){
       if(menuActive){
           $nav.trigger('mouseleave');
       }
   });

});