$.opendialog = function(h2,p=false){ $("#dialog h1").html(h2); if(p!=false) $("#dialog p").html(p); $("#alpha").fadeIn(function(){ $("#dialog").fadeIn(); }); } $(document).ready(function(){ $(window).on("scroll",function(){ offset = $(document).scrollTop(); showat = 100; if(offset>showat){ $("#totop").fadeIn("slow"); $("header").addClass("inaktiv"); }else{ $("#totop").fadeOut("slow"); $("header").removeClass("inaktiv"); } }); $("#logo").click(function(){ top.location.href = 'https://www.arbeitshygiene.de/'; }); $(".icon-chevron-down").click(function(){ posTop = $("#content").position().top-100; $("html, body").animate({scrollTop:posTop},700); }); $("#totop").click(function(){ $("html, body").animate({scrollTop:0},700); }); $(".close").click(function(){ $(this).parent().fadeOut("slow",function(){ $("#alpha").fadeOut(); }); }); $("#alpha").click(function(){ $(this).fadeOut(); $("#dialog").fadeOut(); }); $("#memberslogin").click(function(){ $("#dialog p").load("https://www.arbeitshygiene.de/contents/loginform.php"); $.opendialog(""); }); $("#addnews").click(function(){ newsaddress = $("input[name=newslettermail]").val().trim(); fehler = 0; tmp = newsaddress.split("@"); dot = tmp[1].split("."); if(tmp.length==2 && tmp[0]!="" && tmp[1]!="" && dot.length>=2 && dot[0]!="" && dot[1]!=""){ $.post("https://www.arbeitshygiene.de/fkt/addNewsletter.php",{"newsaddress":newsaddress},function(data){ if(data==1){ $("input[name=newslettermail]").val(""); $.opendialog("",""); } }); } }); $("#burger").click(function(){ $("#mobilenav").addClass("aktiv"); }); $("#mobilenav .sub").hide(); $("#mobilenav .icon-chevron-small-down").click(function(){ target = $(this).attr("data-target"); $("#mobilenav .aktiv").slideUp("slow"); $("#mobilenav .aktiv").removeClass("aktiv"); $("."+target).slideDown("slow"); $("."+target).addClass("aktiv"); }); $("a.extern").click(function(){ window.open($(this).attr("href")); return false; }); AOS.init({ easing: 'ease-in-out-sine', offset: 100, // offset (in px) from the original trigger point delay: 0, // values from 0 to 3000, with step 50ms duration: 1000, // values from 0 to 3000, with step 50ms /* once: false, // whether animation should happen only once - while scrolling down */ mirror: true }); }); function unserialize(data) { data = data.split('&'); var response = {}; for (var k in data){ var newData = data[k].split('='); response[newData[0]] = newData[1]; } return response; }