From: Anthony Talarico Date: Mon, 22 Feb 2016 20:30:21 +0000 (-0500) Subject: highlight current page sidelinks X-Git-Tag: v1.0.0^2~149 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=05f08e29c855dd033cec0bfb4fda690c84a7f0b7;p=WP-Themes%2FDiscoverKZOO.git highlight current page sidelinks --- diff --git a/css/app.css b/css/app.css index b101df1..2db7b7e 100644 --- a/css/app.css +++ b/css/app.css @@ -7360,6 +7360,9 @@ article { .current_page_item a { font-weight: bold; } +.current { + color: #57b649 !important; } + .search-top #searchform { text-align: left; display: inline-block; diff --git a/js/app.js b/js/app.js index dbcbc37..df0a835 100644 --- a/js/app.js +++ b/js/app.js @@ -31,29 +31,6 @@ $(document).ready(function () { //console.log('ul = ' + menuImg); //console.log('menu-id = ' + menuNum); }); -// var blocks = { -// init: function (){ -// this.bindEvents(); -// }, -// bindEvents: function (){ -// $('#block-1, #block-2, #block-3, #block-4').bind('click tap', function(){ -// if($(window).width() <= 1024){ -// $(this).toggleClass('front-page-blocks'); -// } -// }); -// $('#block-1, #block-2, #block-3, #block-4').on("mouseover", function (){ -// if($(window).width() > 1024){ -// $(this).addClass('front-page-blocks'); -// } -// }); -// $('#block-1, #block-2, #block-3, #block-4').on("mouseout", function (){ -// if($(window).width() > 1024){ -// $(this).removeClass('front-page-blocks'); -// } -// }); -// } -// }; -// blocks.init(); $("#searchIcon").click(function(){ if($("#topSearchForm").css("display") == "none"){ // $("#searchform").css("display", "inline"); @@ -80,4 +57,18 @@ $(document).ready(function () { // remove drop down arrow icons from sub menu items $("#menu-menu-1").find(".dropdown").children("li").removeClass("has-dropdown"); + + // remove #/gallery/recent from url to track current page + var url = window.location.href.replace("#/gallery/recent", ""); + + // 'current' class style to sidebar item that matches the current url + $('#side-links ul.sidebar li a').each(function() { + if ($(this).prop('href') == url) { + $(this).addClass('current'); + } + if($(this).attr("class") === "current"){ + $(this).parent("li").addClass("current"); + } + }); + }); diff --git a/js/custom/pageSetup.js b/js/custom/pageSetup.js index 1a33cf8..3ea64ea 100644 --- a/js/custom/pageSetup.js +++ b/js/custom/pageSetup.js @@ -22,29 +22,6 @@ $(document).ready(function () { //console.log('ul = ' + menuImg); //console.log('menu-id = ' + menuNum); }); -// var blocks = { -// init: function (){ -// this.bindEvents(); -// }, -// bindEvents: function (){ -// $('#block-1, #block-2, #block-3, #block-4').bind('click tap', function(){ -// if($(window).width() <= 1024){ -// $(this).toggleClass('front-page-blocks'); -// } -// }); -// $('#block-1, #block-2, #block-3, #block-4').on("mouseover", function (){ -// if($(window).width() > 1024){ -// $(this).addClass('front-page-blocks'); -// } -// }); -// $('#block-1, #block-2, #block-3, #block-4').on("mouseout", function (){ -// if($(window).width() > 1024){ -// $(this).removeClass('front-page-blocks'); -// } -// }); -// } -// }; -// blocks.init(); $("#searchIcon").click(function(){ if($("#topSearchForm").css("display") == "none"){ // $("#searchform").css("display", "inline"); @@ -71,4 +48,18 @@ $(document).ready(function () { // remove drop down arrow icons from sub menu items $("#menu-menu-1").find(".dropdown").children("li").removeClass("has-dropdown"); + + // remove #/gallery/recent from url to track current page + var url = window.location.href.replace("#/gallery/recent", ""); + + // 'current' class style to sidebar item that matches the current url + $('#side-links ul.sidebar li a').each(function() { + if ($(this).prop('href') == url) { + $(this).addClass('current'); + } + if($(this).attr("class") === "current"){ + $(this).parent("li").addClass("current"); + } + }); + }); diff --git a/scss/_sidebar.scss b/scss/_sidebar.scss index 985616e..2616d14 100644 --- a/scss/_sidebar.scss +++ b/scss/_sidebar.scss @@ -167,4 +167,7 @@ } .current_page_item a { font-weight: bold; +} +.current{ + color: $green !important; } \ No newline at end of file