Files
2023-07-12 16:31:19 +01:00

46 lines
1.2 KiB
JavaScript
Executable File

var jQuery = require('jquery');
var $ = jQuery;
// var foundation = require('foundation-sites');
let mobile = false;
$(document).ready(function(){
if( navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i)){
mobile = true;
}
//
$(".main a").attr("target","_blank");
//adjust menu grid :
let ni = $(".nav li").length;
$(".nav").css('grid-template-columns','repeat('+ni+', 1fr)');
$(".subnav").css('grid-template-columns','repeat('+ni+', 1fr)')
//nav behavior
if (mobile != true ) {
$(".navigation").on("mouseover", function(){
$(".subnav").addClass("grid");
});
$(".navigation").on("mouseout", function(){
$(".subnav").removeClass("grid");
});
}
//QD solution
if (mobile == true ) {
$('.nav').slideToggle();
}
$(".show_menu").click(function(){
$('.nav').slideToggle();
});
$(window).on('load', function() {
var url = window.location.href;
var hash = url.split("#");
let h = hash[hash.length - 1];
if(h == "newsletter"){
let elem = $(".header .newsletter").find("a");
$(elem).click();
}
});
});