Difference between revisions of "Template:Team:TU Eindhoven/Menu Script"

 
(138 intermediate revisions by 4 users not shown)
Line 18: Line 18:
 
     });
 
     });
  
//scroll zooi van hans
+
//Wikitour
    jQuery(window).on("hashchange", function () {
+
$(document).ready(function(){
        window.scrollTo(window.scrollX, window.scrollY - 100);
+
var landingPageHeight = $('#landingPage').height();
    });
+
        var windowHeight = $(window).height();
 +
        var scrollNow = landingPageHeight - windowHeight;
  
//Nieuwe scrollzooi van Hans
+
$('#wikiTour').hover( function(){$('#wikiTour').fadeTo(0,1);}, function(){
 +
                if ($(window).scrollTop() > 0) {
 +
$('#wikiTour').fadeTo(0, 1);
 +
} else {
 +
$('#wikiTour').fadeTo(0, 0.4);                                                               
 +
} }); 
  
/*!
+
//Check to see if the window is top if not then display button
* jQuery Smooth Scroll - v1.5.6 - 2015-09-08
+
$(window).scroll(function(){
* https://github.com/kswedberg/jquery-smooth-scroll
+
* Copyright (c) 2015 Karl Swedberg
+
* Licensed MIT (https://github.com/kswedberg/jquery-smooth-scroll/blob/master/LICENSE-MIT)
+
*/
+
  
(function (factory) {
+
if ($(window).scrollTop() > 0) {
  if (typeof define === 'function' && define.amd) {
+
$('#wikiTour').fadeTo(0, 1);
    // AMD. Register as an anonymous module.
+
} else {
    define(['jquery'], factory);
+
$('#wikiTour').fadeTo(0, 0.4);                                                              
  } else if (typeof module === 'object' && module.exports) {
+
}
    // CommonJS
+
 
     factory(require('jquery'));
+
      });
  } else {
+
    // Browser globals
+
});
    factory(jQuery);
+
 
 +
//scroll zooi van hans
 +
$("a[href*=#]").click(function(e) {
 +
if($(this).hasClass("extern")){
 +
return;
 +
}
 +
     e.preventDefault();
 +
var id= $(this).attr('href');
 +
id = id.substring(id.lastIndexOf("#"));
 +
var el = $(id);
 +
//If there is no element with this id, check for name attribute
 +
if (el.length <= 0){
 +
el = $('[name=' + id.substring(1)+ ']');
 
   }
 
   }
}(function ($) {
+
$('html, body').animate({ scrollTop: el.offset().top - 40}, 1000);
  
  var version = '1.5.6',
+
});
      optionOverrides = {},
+
      defaults = {
+
        exclude: [],
+
        excludeWithin:[],
+
        offset: 0,
+
  
        // one of 'top' or 'left'
+
$(window).scroll(function(){
        direction: 'top',
+
if( $(window).scrollTop() == 0){
 +
$("#scrollUp").css("display","none");
 +
}
 +
else{
 +
$("#scrollUp").css("display","initial");
 +
}
  
        // jQuery set of elements you wish to scroll (for $.smoothScroll).
+
    $("#scrollUp").css("opacity", $(window).scrollTop() / 400);
        //  if null (default), $('html, body').firstScrollable() is used.
+
        scrollElement: null,
+
 
+
        // only use if you want to override default behavior
+
        scrollTarget: null,
+
 
+
        // fn(opts) function to be called before scrolling occurs.
+
        // `this` is the element(s) being scrolled
+
        beforeScroll: function() {},
+
 
+
        // fn(opts) function to be called after scrolling occurs.
+
        // `this` is the triggering element
+
        afterScroll: function() {},
+
        easing: 'swing',
+
        speed: 400,
+
 
+
        // coefficient for "auto" speed
+
        autoCoefficient: 2,
+
 
+
        // $.fn.smoothScroll only: whether to prevent the default click action
+
        preventDefault: true
+
      },
+
 
+
      getScrollable = function(opts) {
+
        var scrollable = [],
+
            scrolled = false,
+
            dir = opts.dir && opts.dir === 'left' ? 'scrollLeft' : 'scrollTop';
+
 
+
        this.each(function() {
+
          var el = $(this);
+
 
+
          if (this === document || this === window) {
+
            return;
+
          }
+
 
+
          if ( document.scrollingElement && (this === document.documentElement || this === document.body) ) {
+
            scrollable.push(document.scrollingElement);
+
 
+
            return false;
+
          }
+
 
+
          if ( el[dir]() > 0 ) {
+
            scrollable.push(this);
+
          } else {
+
            // if scroll(Top|Left) === 0, nudge the element 1px and see if it moves
+
            el[dir](1);
+
            scrolled = el[dir]() > 0;
+
            if ( scrolled ) {
+
              scrollable.push(this);
+
            }
+
            // then put it back, of course
+
            el[dir](0);
+
          }
+
        });
+
 
+
        // If no scrollable elements, fall back to <body>,
+
        // if it's in the jQuery collection
+
        // (doing this because Safari sets scrollTop async,
+
        // so can't set it to 1 and immediately get the value.)
+
        if (!scrollable.length) {
+
          this.each(function() {
+
            if (this.nodeName === 'BODY') {
+
              scrollable = [this];
+
            }
+
          });
+
        }
+
 
+
        // Use the first scrollable element if we're calling firstScrollable()
+
        if ( opts.el === 'first' && scrollable.length > 1 ) {
+
          scrollable = [ scrollable[0] ];
+
        }
+
 
+
        return scrollable;
+
      };
+
 
+
  $.fn.extend({
+
    scrollable: function(dir) {
+
      var scrl = getScrollable.call(this, {dir: dir});
+
      return this.pushStack(scrl);
+
    },
+
    firstScrollable: function(dir) {
+
      var scrl = getScrollable.call(this, {el: 'first', dir: dir});
+
      return this.pushStack(scrl);
+
    },
+
 
+
    smoothScroll: function(options, extra) {
+
      options = options || {};
+
 
+
      if ( options === 'options' ) {
+
        if ( !extra ) {
+
          return this.first().data('ssOpts');
+
        }
+
        return this.each(function() {
+
          var $this = $(this),
+
              opts = $.extend($this.data('ssOpts') || {}, extra);
+
 
+
          $(this).data('ssOpts', opts);
+
        });
+
      }
+
 
+
      var opts = $.extend({}, $.fn.smoothScroll.defaults, options),
+
          locationPath = $.smoothScroll.filterPath(location.pathname);
+
 
+
      this
+
      .unbind('click.smoothscroll')
+
      .bind('click.smoothscroll', function(event) {
+
        var link = this,
+
            $link = $(this),
+
            thisOpts = $.extend({}, opts, $link.data('ssOpts') || {}),
+
            exclude = opts.exclude,
+
            excludeWithin = thisOpts.excludeWithin,
+
            elCounter = 0, ewlCounter = 0,
+
            include = true,
+
            clickOpts = {},
+
            hostMatch = ((location.hostname === link.hostname) || !link.hostname),
+
            pathMatch = thisOpts.scrollTarget || ( $.smoothScroll.filterPath(link.pathname) === locationPath ),
+
            thisHash = escapeSelector(link.hash);
+
 
+
        if ( !thisOpts.scrollTarget && (!hostMatch || !pathMatch || !thisHash) ) {
+
          include = false;
+
        } else {
+
          while (include && elCounter < exclude.length) {
+
            if ($link.is(escapeSelector(exclude[elCounter++]))) {
+
              include = false;
+
            }
+
          }
+
          while ( include && ewlCounter < excludeWithin.length ) {
+
            if ($link.closest(excludeWithin[ewlCounter++]).length) {
+
              include = false;
+
            }
+
          }
+
        }
+
 
+
        if ( include ) {
+
 
+
          if ( thisOpts.preventDefault ) {
+
            event.preventDefault();
+
          }
+
 
+
          $.extend( clickOpts, thisOpts, {
+
            scrollTarget: thisOpts.scrollTarget || thisHash,
+
            link: link
+
          });
+
 
+
          $.smoothScroll( clickOpts );
+
        }
+
      });
+
 
+
      return this;
+
    }
+
 
   });
 
   });
  
  $.smoothScroll = function(options, px) {
+
$("#scrollUp").click(function() {
    if ( options === 'options' && typeof px === 'object' ) {
+
$('html, body').animate({ scrollTop: 0}, 1000);
      return $.extend(optionOverrides, px);
+
setTimeout(function(){$("#scrollUp").css("bottom","calc(0)");},1000);
    }
+
});
    var opts, $scroller, scrollTargetOffset, speed, delta,
+
        scrollerOffset = 0,
+
        offPos = 'offset',
+
        scrollDir = 'scrollTop',
+
        aniProps = {},
+
        aniOpts = {};
+
 
+
    if (typeof options === 'number') {
+
      opts = $.extend({link: null}, $.fn.smoothScroll.defaults, optionOverrides);
+
      scrollTargetOffset = options;
+
    } else {
+
      opts = $.extend({link: null}, $.fn.smoothScroll.defaults, options || {}, optionOverrides);
+
      if (opts.scrollElement) {
+
        offPos = 'position';
+
        if (opts.scrollElement.css('position') === 'static') {
+
          opts.scrollElement.css('position', 'relative');
+
        }
+
      }
+
    }
+
 
+
    scrollDir = opts.direction === 'left' ? 'scrollLeft' : scrollDir;
+
 
+
    if ( opts.scrollElement ) {
+
      $scroller = opts.scrollElement;
+
      if ( !(/^(?:HTML|BODY)$/).test($scroller[0].nodeName) ) {
+
        scrollerOffset = $scroller[scrollDir]();
+
      }
+
    } else {
+
      $scroller = $('html, body').firstScrollable(opts.direction);
+
    }
+
 
+
    // beforeScroll callback function must fire before calculating offset
+
    opts.beforeScroll.call($scroller, opts);
+
 
+
    scrollTargetOffset = (typeof options === 'number') ? options :
+
                          px ||
+
                          ( $(opts.scrollTarget)[offPos]() &&
+
                          $(opts.scrollTarget)[offPos]()[opts.direction] ) ||
+
                          0;
+
 
+
    aniProps[scrollDir] = scrollTargetOffset + scrollerOffset + opts.offset;
+
    speed = opts.speed;
+
 
+
    // automatically calculate the speed of the scroll based on distance / coefficient
+
    if (speed === 'auto') {
+
 
+
      // $scroller.scrollTop() is position before scroll, aniProps[scrollDir] is position after
+
      // When delta is greater, speed will be greater.
+
      delta = aniProps[scrollDir] - $scroller.scrollTop();
+
      if(delta < 0) {
+
        delta *= -1;
+
      }
+
 
+
      // Divide the delta by the coefficient
+
      speed = delta / opts.autoCoefficient;
+
    }
+
 
+
    aniOpts = {
+
      duration: speed,
+
      easing: opts.easing,
+
      complete: function() {
+
        opts.afterScroll.call(opts.link, opts);
+
      }
+
    };
+
 
+
    if (opts.step) {
+
      aniOpts.step = opts.step;
+
    }
+
 
+
    if ($scroller.length) {
+
      $scroller.stop().animate(aniProps, aniOpts);
+
    } else {
+
      opts.afterScroll.call(opts.link, opts);
+
    }
+
  };
+
 
+
  $.smoothScroll.version = version;
+
  $.smoothScroll.filterPath = function(string) {
+
    string = string || '';
+
    return string
+
      .replace(/^\//,'')
+
      .replace(/(?:index|default).[a-zA-Z]{3,4}$/,'')
+
      .replace(/\/$/,'');
+
  };
+
 
+
  // default options
+
  $.fn.smoothScroll.defaults = defaults;
+
 
+
  function escapeSelector (str) {
+
    return str.replace(/(:|\.|\/)/g,'\\$1');
+
  }
+
 
+
}));
+
 
+
  
 
// Get current Page
 
// Get current Page
Line 335: Line 105:
 
    break;
 
    break;
 
case '/Team:TU_Eindhoven/Project/Protocols':
 
case '/Team:TU_Eindhoven/Project/Protocols':
 +
        submenu = 3;
 +
    break;
 +
case '/Team:TU_Eindhoven/Project':
 
         submenu = 3;
 
         submenu = 3;
 
    break;
 
    break;
Line 340: Line 113:
 
         submenu = 3;
 
         submenu = 3;
 
    break;
 
    break;
case '/Team:TU_Eindhoven/Project/Interlab':
+
case '/Team:TU_Eindhoven/Project/Expression_System':
 +
        submenu = 3;
 +
    break;
 +
case '/Team:TU_Eindhoven/Measurement':
 
         submenu = 4;
 
         submenu = 4;
 
    break;
 
    break;
Line 356: Line 132:
 
    break;
 
    break;
 
case '/Team:TU_Eindhoven/Modeling':
 
case '/Team:TU_Eindhoven/Modeling':
 +
        submenu = 5;
 +
    break;
 +
case '/Team:TU_Eindhoven/Modeling/Approach':
 +
        submenu = 5;
 +
    break;
 +
case '/Team:TU_Eindhoven/Modeling/Script':
 +
        submenu = 5;
 +
    break;
 +
case '/Team:TU_Eindhoven/Modeling/Results':
 
         submenu = 5;
 
         submenu = 5;
 
    break;
 
    break;
Line 361: Line 146:
 
         submenu = 6;
 
         submenu = 6;
 
    break;
 
    break;
case '/Team:TU_Eindhoven/Policy_Practices/Timeline':
+
case '/Team:TU_Eindhoven/Policy_Practices/Regulations':
 +
        submenu = 6;
 +
    break;
 +
case '/Team:TU_Eindhoven/Policy_Practices/Stakeholders':
 
         submenu = 6;
 
         submenu = 6;
 
    break;
 
    break;
case '/Team:TU_Eindhoven/Policy_Practices/Educational_outreach':
+
case '/Team:TU_Eindhoven/Policy_Practices/Human_Outreach':
 
         submenu = 6;
 
         submenu = 6;
 
    break;
 
    break;
Line 380: Line 168:
 
    break;
 
    break;
 
case '/Team:TU_Eindhoven/Collaborations/Collaboration_Attributions':
 
case '/Team:TU_Eindhoven/Collaborations/Collaboration_Attributions':
 +
        submenu = 7;
 +
    break;
 +
case '/Team:TU_Eindhoven/Collaborations/CloningGuide/FullScreen':
 
         submenu = 7;
 
         submenu = 7;
 
    break;
 
    break;
Line 389: Line 180:
 
    break;
 
    break;
 
case '/Team:TU_Eindhoven/Safety':
 
case '/Team:TU_Eindhoven/Safety':
 +
        submenu = 9;
 +
    break;
 +
case '/Team:TU_Eindhoven/Safety/Project':
 +
        submenu = 9;
 +
    break;
 +
case '/Team:TU_Eindhoven/Safety/LabEquipment':
 
         submenu = 9;
 
         submenu = 9;
 
    break;
 
    break;
Line 625: Line 422:
 
$("#infoTab").css("top","calc(50% - " + $("#infoTab").outerHeight()/2 + "px");
 
$("#infoTab").css("top","calc(50% - " + $("#infoTab").outerHeight()/2 + "px");
  
if(sessionStorage.getItem('contentMenu') == null){
+
if(localStorage.getItem('contentMenu') == null){
sessionStorage.contentMenu = "true";
+
localStorage.contentMenu = "true";
 
}
 
}
 
else{
 
else{
Line 633: Line 430:
  
 
$("#contentToggle").click(function(){
 
$("#contentToggle").click(function(){
if(sessionStorage.contentMenu == "true"){
+
if(localStorage.contentMenu == "true"){
 
$("#infoTab").css("transition","transform 1s");
 
$("#infoTab").css("transition","transform 1s");
 
var scale = 200/$("#infoTab").outerHeight();
 
var scale = 200/$("#infoTab").outerHeight();
 
$("#infoTab").css("transform","translate(-80%,0) scale(1"+","+scale.toString());
 
$("#infoTab").css("transform","translate(-80%,0) scale(1"+","+scale.toString());
 
$("#contentToggleImg").css("transform","rotate(180deg)");
 
$("#contentToggleImg").css("transform","rotate(180deg)");
sessionStorage.contentMenu = "false";
+
localStorage.contentMenu = "false";
 
}
 
}
 
else{
 
else{
Line 644: Line 441:
 
$("#infoTab").css("transform","translate(0,0) scale(1,1)");
 
$("#infoTab").css("transform","translate(0,0) scale(1,1)");
 
$("#contentToggleImg").css("transform","rotate(0deg)");
 
$("#contentToggleImg").css("transform","rotate(0deg)");
sessionStorage.contentMenu = "true";
+
localStorage.contentMenu = "true";
 
}
 
}
 
});
 
});
Line 665: Line 462:
  
 
});
 
});
 
  
  
 
function contentMenuCheck() {
 
function contentMenuCheck() {
if(sessionStorage.contentMenu == "false"){
+
if(localStorage.contentMenu == "false"){
 
$("#infoTab").css("transition","none");
 
$("#infoTab").css("transition","none");
 
var scale = 200/$("#infoTab").outerHeight();
 
var scale = 200/$("#infoTab").outerHeight();

Latest revision as of 01:06, 21 November 2015

$(document).ready(function() { //uitklap zooi van hans JW is een BITCH HANS is CRACKIE $('.spoilerbutton').click(function() { var id = "spoiler" + $(this).attr("id").match(/\d+/); if ($(this).attr("src").indexOf("Uitgeklapt") != -1) { $(this).attr("src","https://static.igem.org/mediawiki/2015/8/87/TU_Eindhoven_Ingeklapt.png"); $('#' + id).slideToggle(); } else { $(this).attr("src","https://static.igem.org/mediawiki/2015/6/65/TU_Eindhoven_Uitgeklapt.png"); $('#' + id).slideToggle(); }; var element = $(this); element.css("pointer-events","none"); setTimeout(function(){element.css("pointer-events","auto")},400); }); //Wikitour $(document).ready(function(){ var landingPageHeight = $('#landingPage').height(); var windowHeight = $(window).height(); var scrollNow = landingPageHeight - windowHeight; $('#wikiTour').hover( function(){$('#wikiTour').fadeTo(0,1);}, function(){ if ($(window).scrollTop() > 0) { $('#wikiTour').fadeTo(0, 1); } else { $('#wikiTour').fadeTo(0, 0.4); } }); //Check to see if the window is top if not then display button $(window).scroll(function(){ if ($(window).scrollTop() > 0) { $('#wikiTour').fadeTo(0, 1); } else { $('#wikiTour').fadeTo(0, 0.4); } }); }); //scroll zooi van hans $("a[href*=#]").click(function(e) { if($(this).hasClass("extern")){ return; } e.preventDefault(); var id= $(this).attr('href'); id = id.substring(id.lastIndexOf("#")); var el = $(id); //If there is no element with this id, check for name attribute if (el.length <= 0){ el = $('[name=' + id.substring(1)+ ']'); } $('html, body').animate({ scrollTop: el.offset().top - 40}, 1000); }); $(window).scroll(function(){ if( $(window).scrollTop() == 0){ $("#scrollUp").css("display","none"); } else{ $("#scrollUp").css("display","initial"); } $("#scrollUp").css("opacity", $(window).scrollTop() / 400); }); $("#scrollUp").click(function() { $('html, body').animate({ scrollTop: 0}, 1000); setTimeout(function(){$("#scrollUp").css("bottom","calc(0)");},1000); }); // Get current Page locus=$(location).attr('pathname'); submenu = 0; switch (locus) { case '/Team:TU_Eindhoven': submenu = 1; break; case '/Team:TU_Eindhoven/Team': submenu = 2; break; case '/Team:TU_Eindhoven/Team/Members': submenu = 2; break; case '/Team:TU_Eindhoven/Team/Supervisors': submenu = 2; break; case '/Team:TU_Eindhoven/Attributions': submenu = 2; break; case '/Team:TU_Eindhoven/Description': submenu = 3; break; case '/Team:TU_Eindhoven/Project/Design': submenu = 3; break; case '/Team:TU_Eindhoven/Project/Experimental_Approach': submenu = 3; break; case '/Team:TU_Eindhoven/Project/Protocols': submenu = 3; break; case '/Team:TU_Eindhoven/Project': submenu = 3; break; case '/Team:TU_Eindhoven/Notebook': submenu = 3; break; case '/Team:TU_Eindhoven/Project/Expression_System': submenu = 3; break; case '/Team:TU_Eindhoven/Measurement': submenu = 4; break; case '/Team:TU_Eindhoven/ResultsHome': submenu = 4; break; case '/Team:TU_Eindhoven/Results': submenu = 4; break; case '/Team:TU_Eindhoven/Achievements': submenu = 4; break; case '/Team:TU_Eindhoven/Parts': submenu = 4; break; case '/Team:TU_Eindhoven/Modeling': submenu = 5; break; case '/Team:TU_Eindhoven/Modeling/Approach': submenu = 5; break; case '/Team:TU_Eindhoven/Modeling/Script': submenu = 5; break; case '/Team:TU_Eindhoven/Modeling/Results': submenu = 5; break; case '/Team:TU_Eindhoven/Practices': submenu = 6; break; case '/Team:TU_Eindhoven/Policy_Practices/Regulations': submenu = 6; break; case '/Team:TU_Eindhoven/Policy_Practices/Stakeholders': submenu = 6; break; case '/Team:TU_Eindhoven/Policy_Practices/Human_Outreach': submenu = 6; break; case '/Team:TU_Eindhoven/Policy_Practices/Application_scenarios': submenu = 6; break; case '/Team:TU_Eindhoven/Collaborations': submenu = 7; break; case '/Team:TU_Eindhoven/Collaborations/CloningGuide': submenu = 7; break; case '/Team:TU_Eindhoven/Collaborations/AmoyNewsletter': submenu = 7; break; case '/Team:TU_Eindhoven/Collaborations/Collaboration_Attributions': submenu = 7; break; case '/Team:TU_Eindhoven/Collaborations/CloningGuide/FullScreen': submenu = 7; break; case '/Team:TU_Eindhoven/Team/Sponsors': submenu = 8; break; case '/Team:TU_Eindhoven/Safety/Lab': submenu = 9; break; case '/Team:TU_Eindhoven/Safety': submenu = 9; break; case '/Team:TU_Eindhoven/Safety/Project': submenu = 9; break; case '/Team:TU_Eindhoven/Safety/LabEquipment': submenu = 9; break; }; // "submenu" contains the number of the submenu to be shown by default (or 0 for none). // icon var link = document.createElement('link'); link.type = 'image/x-icon'; link.rel = 'shortcut icon'; link.href = 'https://static.igem.org/mediawiki/2015/4/4a/Logo_Eindhoven_small.png'; document.getElementsByTagName('head')[0].appendChild(link); //background $("

").appendTo("body"); $('').appendTo("#background"); var a = 0; var fb_twit = 0; $("#twitter_logo,#twitter").hover( function() { $("#twitter").css("z-index","11"); $("#twitter").css("display","initial"); $("#menu1,#menu2,#menu3,#menu4,#menu5,#menu6,#menu7,#menu8,#menu9").css("color", "#004415"); $("#submenu").css("height","0px"); fb_twit = 1; }, function() { $("#twitter").css("z-index","-1"); $("#twitter").css("display","none"); fb_twit = 0; defaultMenu(); }); $("#facebook_logo,#facebook").hover( function() { $("#facebook").css("z-index","11"); $("#facebook").css("display","initial"); $("#menu1,#menu2,#menu3,#menu4,#menu5,#menu6,#menu7,#menu8,#menu9").css("color", "#004415"); $("#submenu").css("height","0px"); fb_twit = 1; }, function() { $("#facebook").css("z-index","-1"); $("#facebook").css("display","none"); fb_twit = 0; defaultMenu(); }); $("#menu1").hover( function() { a = 1; }); $("#menu2").hover( function() { a = 2; }); $("#menu3").hover( function() { a = 3; }); $("#menu4").hover( function() { a = 4; }); $("#menu5").hover( function() { a = 5; }); $("#menu6").hover( function() { a = 6; }); $("#menu7").hover( function() { a = 7; }); $("#menu8").hover( function() { a = 8; }); $("#menu9").hover( function() { a = 9; }); subhover = 0; menuhover = 0; $("#submenuwrapper").hover( function() { subhover = 1; switch (a) { case 2: $("#menu2").css("color", "#9DC671"); $("#submenu").css("height", "60px"); break; case 3: $("#menu3").css("color", "#9DC671"); $("#submenu").css("height", "60px"); break; case 4: $("#menu4").css("color", "#9DC671"); $("#submenu").css("height", "60px"); break; case 5: $("#menu5").css("color", "#9DC671"); $("#submenu").css("height", "60px"); break; case 6: $("#menu6").css("color", "#9DC671"); $("#submenu").css("height", "60px"); break; case 7: $("#menu7").css("color", "#9DC671"); $("#submenu").css("height", "60px"); break; case 9: $("#menu9").css("color", "#9DC671"); $("#submenu").css("height", "60px"); break; } }, function() { subhover = 0; defaultMenu(); }); $("#menu1,#menu2,#menu3,#menu4,#menu5,#menu6,#menu7,#menu8,#menu9").hover( function() { menuhover = 1; //reset alles en display dan alleen de juiste $("#menu1,#menu2,#menu3,#menu4,#menu5,#menu6,#menu7,#menu8,#menu9").css("color", "#004415"); $("#sub2,#sub3,#sub4,#sub5,#sub6,#sub7,#sub9").css("display","none"); switch (a) { case 1: $("#menu1").css("color", "#9DC671"); $("#submenu").css("height","0px"); break; case 2: $("#menu2").css("color", "#9DC671"); $("#sub2").css("display","block"); $("#submenu").css("height", "60px"); break; case 3: $("#menu3").css("color", "#9DC671"); $("#sub3").css("display","block"); $("#submenu").css("height", "60px"); break; case 4: $("#menu4").css("color", "#9DC671"); $("#sub4").css("display","block"); $("#submenu").css("height", "60px"); break; case 5: $("#menu5").css("color", "#9DC671"); $("#sub5").css("display","block"); $("#submenu").css("height", "60px"); break; case 6: $("#menu6").css("color", "#9DC671"); $("#sub6").css("display","block"); $("#submenu").css("height", "60px"); break; case 7: $("#menu7").css("color", "#9DC671"); $("#sub7").css("display","block"); $("#submenu").css("height", "60px"); break; case 8: $("#menu8").css("color", "#9DC671"); $("#submenu").css("height", "0px"); break; case 9: $("#menu9").css("color", "#9DC671"); $("#sub9").css("display","block"); $("#submenu").css("height", "60px"); break; } }, function() { menuhover = 0; defaultMenu(); }); defaultMenu(); // Show default menu function defaultMenu() { setTimeout(function(){ if (subhover == 1 || menuhover == 1 || fb_twit == 1){ } else{ a = submenu; if (submenu == 1 || submenu == 8 ){ $("#submenu").css("height", "0"); $("#menu1,#menu2,#menu3,#menu4,#menu5,#menu6,#menu7,#menu8,#menu9").css("color", "#004415"); $("#sub2,#sub3,#sub4,#sub5,#sub6,#sub7,#sub9").css("display","none"); $("#menu"+submenu.toString()).css("color", "#9DC671"); } else{ $("#sub2,#sub3,#sub4,#sub5,#sub6,#sub7,#sub9").css("display","none"); $("#submenu").css("height", "60px"); $("#menu1,#menu2,#menu3,#menu4,#menu5,#menu6,#menu7,#menu8,#menu9").css("color", "#004415"); $("#sub"+submenu.toString()).css("display","block"); $("#menu"+submenu.toString()).css("color", "#9DC671"); } } },5); } ! function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https'; if (!d.getElementById(id)) { js = d.createElement(s); js.id = id; js.src = p + "://platform.twitter.com/widgets.js"; fjs.parentNode.insertBefore(js, fjs); } }(document, "script", "twitter-wjs"); (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&version=v2.3"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); //Content Menu $("#contentToggle").css("height",$("#infoTab").outerHeight()); $("#infoTabContent").css("height",$("#infoTabContent").outerHeight()); $("#infoTab").css("top","calc(50% - " + $("#infoTab").outerHeight()/2 + "px"); if(localStorage.getItem('contentMenu') == null){ localStorage.contentMenu = "true"; } else{ contentMenuCheck(); } $("#contentToggle").click(function(){ if(localStorage.contentMenu == "true"){ $("#infoTab").css("transition","transform 1s"); var scale = 200/$("#infoTab").outerHeight(); $("#infoTab").css("transform","translate(-80%,0) scale(1"+","+scale.toString()); $("#contentToggleImg").css("transform","rotate(180deg)"); localStorage.contentMenu = "false"; } else{ $("#infoTab").css("transition","transform 1s"); $("#infoTab").css("transform","translate(0,0) scale(1,1)"); $("#contentToggleImg").css("transform","rotate(0deg)"); localStorage.contentMenu = "true"; } }); $(".contentMenuImg").click( function(){ if($("#contentList" + $(this).attr("id").match(/\d+/)).is(":visible")){ $("#contentMenuImg" + $(this).attr("id").match(/\d+/)).css("transform","rotate(0deg)"); } else{ $("#contentMenuImg" + $(this).attr("id").match(/\d+/)).css("transform","rotate(180deg)"); } $("#contentList" + $(this).attr("id").match(/\d+/)).slideToggle(); var el = $(this); el.css("pointer-events", "none"); setTimeout(function(){el.css("pointer-events","auto")},400); } ) }); function contentMenuCheck() { if(localStorage.contentMenu == "false"){ $("#infoTab").css("transition","none"); var scale = 200/$("#infoTab").outerHeight(); $("#infoTab").css("transform","translate(-80%,0) scale(1"+","+scale.toString()); $("#contentToggleImg").css("transform","rotate(180deg)"); } }