diff --git a/js/faq.js b/js/faq.js new file mode 100644 index 00000000..4be9ea9e --- /dev/null +++ b/js/faq.js @@ -0,0 +1,56 @@ +$( document ).ready( function() { + + //FAQ Accordion + $('.accordion').each(function() { + + $(this).find('.accordion-toggle').click(function(event) { + event.preventDefault(); + + $(".accordion-toggle").not($(this)).removeClass('accordion-toggle-active'); + + if($(this).hasClass('accordion-toggle-active')){ + $(this).removeClass('accordion-toggle-active'); + }else{ + $(this).addClass('accordion-toggle-active'); + } + + $(this).next().slideToggle('fast'); + $(".accordion-content").not($(this).next()).slideUp('fast'); + + if($(this).attr('id') !== undefined) { + //add hash to url + if(history.pushState) { + history.pushState(null, null, '#' + $(this).attr('id')); + } else { + location.hash = '#' + $(this).attr('id'); + } + } + }); + }); + + if( window.location.hash ) { + showAccordionItem(); + } + + $( ".accordion-content a" ).on( "click", function() { + var address = $(this).attr('href'); + if( address.charAt(0) === '#' ) { + showAccordionItem( address ); + }; + return; + }); + + function showAccordionItem( anchorAddress ) { + + var address = anchorAddress ? anchorAddress : window.location.hash; + + $("html, body").animate( { + scrollTop: ( $( address ).offset().top - 100 ) + }, 1000 ); + + $( address ).addClass( 'accordion-toggle-active' ).next().slideToggle( 'fast' ); + + return; + } + +}); diff --git a/js/scripts.js b/js/home.js similarity index 65% rename from js/scripts.js rename to js/home.js index c31c1872..f6bcfc84 100644 --- a/js/scripts.js +++ b/js/home.js @@ -1,6 +1,5 @@ $( document ).ready( function() { - /************************************************** detect os to show correct download links **************************************************/ @@ -73,7 +72,10 @@ $( document ).ready( function() { return; } - //How to get started + /************************************************** + hover actions for the "how to get started" section + **************************************************/ + $('.step').on({ mouseenter: function () { $('.step').css('opacity', 0.5), @@ -83,66 +85,4 @@ $( document ).ready( function() { }, mouseout: function () {} }); - - - //FAQ Accordion - $('.accordion').each(function() { - - $(this).find('.accordion-toggle').click(function(event) { - event.preventDefault(); - - $(".accordion-toggle").not($(this)).removeClass('accordion-toggle-active'); - - if($(this).hasClass('accordion-toggle-active')){ - $(this).removeClass('accordion-toggle-active'); - }else{ - $(this).addClass('accordion-toggle-active'); - } - - $(this).next().slideToggle('fast'); - $(".accordion-content").not($(this).next()).slideUp('fast'); - - if($(this).attr('id') !== undefined) { - //add hash to url - if(history.pushState) { - history.pushState(null, null, '#' + $(this).attr('id')); - } else { - location.hash = '#' + $(this).attr('id'); - } - } - }); - }); - - if( window.location.hash ) { - showAccordionItem(); - } - - $( ".accordion-content a" ).on( "click", function() { - var address = $(this).attr('href'); - if( address.charAt(0) === '#' ) { - showAccordionItem( address ); - }; - return; - }); - - function showAccordionItem( anchorAddress ) { - - var address = anchorAddress ? anchorAddress : window.location.hash; - - $("html, body").animate( { - scrollTop: ( $( address ).offset().top - 100 ) - }, 1000 ); - - $( address ).addClass( 'accordion-toggle-active' ).next().slideToggle( 'fast' ); - - return; - } - - - $( ".mode-toggle" ).on( "click", function() { - $("body").toggleClass("dark-mode"); - $("body").hasClass("dark-mode") ? Cookies.set("darkmode", 1) : Cookies.set("darkmode", 0); - return; - }); - }); diff --git a/js/site.js b/js/site.js new file mode 100644 index 00000000..a4dd2108 --- /dev/null +++ b/js/site.js @@ -0,0 +1,13 @@ +$( document ).ready( function() { + + /************************************************** + dark mode toggle + **************************************************/ + + $( ".mode-toggle" ).on( "click", function() { + $("body").toggleClass("dark-mode"); + $("body").hasClass("dark-mode") ? Cookies.set("darkmode", 1) : Cookies.set("darkmode", 0); + return; + }); + +});