From faf6d9090d128b39b107fada1f9aea3d08cca615 Mon Sep 17 00:00:00 2001 From: janis Date: Thu, 24 Nov 2022 13:41:41 +0100 Subject: [PATCH] added code to highlight current page --- css/menustyle.css | 1 + index.html | 3 +-- js/basicanimations.js | 16 +++++++++++++++- js/jquery.js | 2 ++ menu.html | 8 ++++---- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/css/menustyle.css b/css/menustyle.css index 915f4d3..6a2ccd6 100644 --- a/css/menustyle.css +++ b/css/menustyle.css @@ -70,6 +70,7 @@ .dropdown:hover .dropdown-menu { display: block; + margin: 0; animation: rotateMenu 300ms ease-in-out forwards; } diff --git a/index.html b/index.html index e5bb952..2a5165a 100644 --- a/index.html +++ b/index.html @@ -17,7 +17,6 @@ Projects


-Note: This website is not completed yet and some pages are still missing! - +Note: This website is not completed yet and some pages are still missing! The design will also change to something more appealing in the future diff --git a/js/basicanimations.js b/js/basicanimations.js index c8054cd..583d6e2 100644 --- a/js/basicanimations.js +++ b/js/basicanimations.js @@ -12,4 +12,18 @@ $(document).ready(function() { $(".textlink").mouseleave(function() { $(this).animate({"color": "black", "font-size": "100%"}, 200) }) -}); \ No newline at end of file + setTimeout(highlightLocation, 200) +}); + +function highlightLocation () { + let pagename = $(location).attr('pathname') + if (pagename.slice(0, 8) == "/project") { + $('#projects').css("background-color", "darkblue") + } else if (pagename.slice(0, 6) == "/about") { + $('#about').css("background-color", "darkblue") + } else if (pagename == "/" || pagename == "/index.html") { + $('#home').css("background-color", "darkblue") + } else if (pagename == "/support.html") { + $('#support').css("background-color", "darkblue") + } +} \ No newline at end of file diff --git a/js/jquery.js b/js/jquery.js index 12e65d0..e6fadc3 100644 --- a/js/jquery.js +++ b/js/jquery.js @@ -11,6 +11,8 @@ * * Date: 2022-08-26T17:52Z */ + +console.log("loaded jquery"); ( function( global, factory ) { "use strict"; diff --git a/menu.html b/menu.html index 2889959..05266f8 100644 --- a/menu.html +++ b/menu.html @@ -6,9 +6,9 @@ \ No newline at end of file