Team:UCLouvain/main.js

(function($){ $(window).load(function(){ if($(".animsition").length){ $(".animsition").animsition({ inClass  : 'fade-in-up-sm', outClass  : 'fade-out-up-sm', inDuration  : 1100, outDuration  : 800, linkElement  : '.animsition-link', loading  : true, loadingParentElement  : 'body', unSupportCss  : [ 'animation-duration', '-webkit-animation-duration', '-o-animation-duration' ], overlay  : false, overlayClass  : 'animsition-overlay-slie', overlayParentElement  : 'body' }); }

var _link = $("nav.desktop-nav ul.first-level").children("li"); var shown = false; $(".menu-icon").click(function(){ var _this = $(this); $("nav.mobile-nav").slideToggle(200); if(!shown){ _this.children("div").css("width","30px"); shown = true; }else{ _this.children("div").first().css("width","30px"); _this.children("div").eq(1).css("width","15px"); _this.children("div").eq(2).css("width","20px"); shown = false; } });

_link.hover(function(e){ e.preventDefault(); var _this = $(this); if(_this.children("ul.second-level").html() !== undefined){ if(e.type === "mouseenter"){ _this.children("ul.second-level").slideDown(200); }else{ _this.children("ul.second-level").slideUp(200); } } });

$("nav.mobile-nav").html($("nav.desktop-nav").html()); // set navbar

var mobile_link = $("nav.mobile-nav ul.first-level").children("li"); mobile_link.children("a").click(function(e){ var _this = $(this); var submenu_exists = (_this.next("ul.second-level").html() === undefined) ? false : true; if(submenu_exists){ e.preventDefault(); $(".down").slideUp(200); if(_this.next("ul.second-level").hasClass("down")){ _this.next("ul.second-level").removeClass("down"); }else{ $(".down").removeClass("down"); _this.next("ul.second-level").slideDown(200); _this.next("ul.second-level").addClass("down"); } } });

}); })(jQuery);