Focusing solely on a particular category in EJS

I am struggling with this code snippet.

HTML:

<header<% if (  current.source === 'features' ||  current.path[0] === 'index' ||  current.source !== 'customers' ) { %> class="header-white"<% } %>>
<div class="row">
    <div class="small-3 columns">
        <div class="logo">
            <a href="/">
                <svg class="handsontable-logo">
                    <use xlink:href="#handsontable-logo"></use>
                </svg>
            </a>
            <a href="//github.com/handsontable/handsontable" id="github-star" class="star-counter" target="_blank">
                <svg>
                    <use xlink:href="#github-squid"></use>
                </svg>
                <div class="github-star">
                    <div class="triangle"></div>
                    <div data-bind="starsCount">-</div>
                </div>
            </a>
        </div>
    </div>

    <div class="small-9 columns text-right">
        <nav class="mobile-inactive">
            <a href="#" id="mobile-nav-menu">
                <svg>
                    <use xlink:href="#open-mobile-nav"></use>
                </svg>
            </a>
            <ul>
                <li class="mobile-only"><a href="/">Home</a></li>
                <li><a href="/features.html">Features</a></li>
                <li><a
                       href="/examples.html?manual-resize&manual-move&conditional-formatting&context-menu&filters&dropdown-menu&headers">
                        Examples
                    </a></li>
                <li><a href="/download.html">Download</a></li>
                <li><a href="/pricing.html">Pricing</a></li>
                <li><a href="/customers">Case studies</a></li>
                <li><a href="/developers.html">Developers</a></li>
                <li class="mobile-only"><a href="/resellers.html">Resellers</a></li>
                <li class="mobile-only"><a href="/blog/">Blog</a></li>
                <li class="mobile-only"><a href="/contact.html">Contact</a></li>
                <li class="news">
                    <svg>
                        <use xlink:href="#bell"></use>
                    </svg>
                </li>
                <li><a href="//my.handsontable.com/sign-in.html"
                       class="btn size-small bg-green-light bg-lighten text-white">
                        Sign in
                    </a>
                </li>
            </ul>
        </nav>
    </div>
</div>

SCSS:

header {
@include absolute-top-left (0, 0);
width: 100%;
padding: 34px 0 0;
z-index: 1;

.logo {
@include relative-top-left (-3px, 0);

@media only screen and (min-width: $largeWidth) {
  @include relative-top-left (10px, 0);
 }

svg {

  &.handsontable-logo {
    @include rectangle (130px, 25px);
    fill: $baseGray;
  }
}
}

 /* Begin: This allows to stretch the mobile menu to 100% of width of the viewport */
 & > .row > .columns:last-child {
position: static;
 }
  /* End */

nav {

& > a {
  @include absolute-top-right (4px, 5px);
  padding: 20px;
  display: block;
  z-index: 11;

  @media only screen and (min-width: $largeWidth) {
    display: none;
  }

  svg {
    @include square (28px);
    fill: $baseGray;
  }
}

ul {
  display: none;

  @media only screen and (min-width: $largeWidth) {
    display: block;
  }

  li {
    padding: 0 19px;
    display: inline-block;

    &:last-child {
      padding-right: 0;
    }

    &.mobile-only {
      display: none;
    }

    &.news {
      padding-right: 32px;
      position: relative;

      svg {
        @include square (18px);
        @include relative-top-left (4px, 0);
        fill: $baseGray;
      }

      #HW_badge_cont {
        @include absolute-top-left (0, 13px);

        #HW_badge {
          @include square (12px);
          @include relative-top-left (0, 0);
          line-height: 13px;
          background-color: $brandRedActive;

          &.HW_softHidden {
            opacity: .4;
            background-color: $brandVibrantGreenActive;
          }
        }
      }
    }

    a, a:hover, a:active, a:visited {
      font-size: 13px;
      color: $baseGray;
    }

    a:hover {
      color: $darkGray;
    }

  }
}
}

  /* Menu visible only on mobile devices */
 nav.mobile-active {

@media only screen and (min-width: $largeWidth) {
  display: none;
  }

& > a {

  svg {
    fill: $darkGray;
  }
}

ul {
  @include absolute-top-left (12px, 2%);
  width: 96%;
  padding: 66px 0 8px;
  display: block;
  text-align: center;
  border-radius: 4px;
  z-index: 10;
  box-shadow: 0 3px 18px rgba(0, 0, 0, 0.15), 0 3px 18px rgba(0, 0, 0, 0.15);
  background: #fff;

  li {
    width: 49%;
    padding: 10px 0;

    &.mobile-only {
      display: inline-block;
    }

    a, a:hover, a:active, a:visited {
      font-size: 18px;
      color: $brandBlue;

      &.btn {
        width: 100%;
        color: #fff;
        font-size: 18px;
      }
    }

    &:last-child {
      width: 90%;
      padding-top: 40px;
    }

    &.news {
      display: none;
    }
  }
}
 }

 &.header-white {

.logo {

  .github-star {
    border: 1px solid $darkWhite;
    color: $darkWhite;
    font-weight: 600;

    .triangle {
      border-right-color: $darkWhite;
    }
  }

  svg {
    fill: $darkWhite;
  }
}

a, a:hover, a:active, a:visited {
  color: #fff;
}

a:hover:not(.btn) {
  color: $brandFeatherBlue;
}

svg, .news svg {
  fill: #fff;
   }
 }
}

The issue I'm facing is that I need to change the navigation color specifically for the customers page.

The complication arises when all subpages within the customer's category also inherit the modified navigation style.

Therefore:

customers === white
| subfolder === white
| subfolder === white
| subfolder === white

To maintain consistency, I want the subfolders within the customer's directory to retain the original navigation color.

If anyone can provide assistance, I would greatly appreciate it as I currently do not have expertise in JavaScript but am eager to learn.

Answer ā„–1

Condensing it down to the important parts, here is your SCSS code:

header {
  &.header-white {
    a, a:hover, a:active, a:visited {
      color: #fff;
    }
  }
}

This will change all your links to white.

If this pertains to your 'customers' section:

<li><a href="/customers">Case studies</a></li>

You can differentiate it by adding a class:

<li><a class="customers" href="/customers">Case studies</a></li>

Then adjust the CSS as needed:

header {
  &.header-white {
    a.customers {
      &, &:hover, &:active, &:visited {
        color: #fff;
      }
    }
  }
}

Answer ā„–2

Issue resolved:

I realized I had been approaching the problem incorrectly by trying to link the exact path like this:

 <header<% if (  current.source === 'features' ||  current.path[0] === 'index' ||  current.source !== 'customers' ) { %> class="header-white"<% } %>>

Instead, all I needed to do was determine the specific length of the link, as shown here:

 <header<% if (  current.source === 'features' ||  current.path[0] === 'index' || current.path[1] === 'index' ) { %> class="header-white"<% } %>>

This solution worked for me, the main challenge was identifying the names and lengths of subpages.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Creating a unique and personalized dual-row navigation bar using Bootstrap

Currently, I am striving to achieve a "conflict free" two-row fixed-top navbar in Bootstrap 3. I am unsure if it necessitates two separate "navbars" according to the official Bootstrap definition. While I possess decent coding skills, my knowledge of the B ...

Is it possible to encode JavaScript with masked binary values?

This segment of code produces the output D. The real question is - HOW? alert([][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![] ...

Navigating through an array containing references to object IDs with Mongoose

In my meanjs project, I am receiving user input on the server with a specific request body structure: { transaction: { heading: '', items: [Object] }, something: {}, somethingAgain: {} } The format of the items a ...

Leveraging configuration files in AngularJS

I'm working on an Angular application that communicates with a Node.js backend Express application. I am using a config file to store environment variables for my Node app. Here's how I access the config file in my Node app: index.js var port = ...

What is the best way to extract all "conditions" nested under the key "logic" at the 0th index in a JSON object?

I need to manipulate a nested object by removing every "condition" where the key is "logic" and the value is 0 from it. Here is an example of the object structure: Original input: [ { "conditions": [ { "logic": "AND", "paramet ...

Unable to retrieve DOM value due to Vue.js template being inaccessible in Chromium, including from both DevTools and extensions

Currently, Iā€™m developing a Chrome extension that needs to retrieve specific values from a webpage such as the item title. However, instead of fetching the actual title, it is reading a Vue.js template variable. Even when I use DevTools to inspect the p ...

Tips for adding JSON values to an object

There is a specific object called SampleObject which has the following structure: { ID: "", Name: "", URL: "", prevName: "", Code: "", } I am looking to insert the values from the JSON object below (values only): var object = { "Sample ...

Utilizing Sequelize validation through condition objects

const db = require("../models"); const Meet = db.meet; checkDuplicateTime = (req, res, next) => { Meet.findAll({ where: { tanggal: req.body.date, waktu: req.body.time } }).then(time => { ...

Matching numbers that begin with zero or are completely optional using Regex

Attempting to come up with a regex pattern that will allow the entry of the specified input into an HTML input field: The input must begin with 0 The input can be left empty and characters may be deleted by the user ^[^1-9]{0,1}[0-9\\s-\& ...

Looking for assistance in minimizing the gap between the banner and content on my Weebly website

Currently, I am utilizing Weebly templates and working with the CSS files for my website located at www.zxentest.weebly.com. I am seeking assistance in reducing the space between the yellow banner and the faint line on either side, as well as decreasing t ...

Unable to establish connection with nodejs server from external devices

Currently, I am leveraging a React client along with a Node.js server (MERN Stack). The server operates smoothly on my computer; however, I encounter difficulties when attempting to connect from my mobile phone to the IPv4 of my PC using the correct port ...

Select a Button to randomly choose another Button

I am currently developing a dynamic Bootstrap OnePage-Website using HTML, CSS, and JavaScript. The highlight of this website is the Team section where users can book appointments with one of three team members by clicking on a corresponding button beneat ...

Can you explain the distinction between using this.function and making a function call in React?

I'm new to React and recently came across some code in a project that confused me. Could someone please clarify the distinction between this.function and the following function call used in a React event handling prop? <button onClick={this.clickH ...

vue mapGetters not fetching data synchronously

Utilizing vuex for state management in my application, I am implementing one-way binding with my form. <script> import { mapGetters } from 'vuex' import store from 'vuex-store' import DataWidget from '../../../../uiCo ...

How can I create a circular Datepicker in JavaFX?

Struggling with customizing my JavaFX application using CSS. Everything was going smoothly until I encountered the Datepicker. Despite trying various approaches, none seem to be working. Is there a way to round the Datepicker just like my TextFields? Here ...

The script from '*' is being denied execution because its MIME type ('application/json') is not executable, and a strict MIME type check is in place

Here is the code I used to retrieve data from the confluence rest api: <script type="text/javascript" src="Scripts/jquery.min.js"></script> <script> $.ajax({ type: "GET", url: "https://blog.xxxxx.com/rest/api/content? ...

Combining PageObjects with non-angular pages: is it possible?

I am currently working on writing protractor tests for our application. One specific challenge I have encountered is dealing with a non-angular page within an angular page as an iframe. The issue I am facing is that I cannot properly map fields from the n ...

Basic HTML Audio Player Featuring Several Customizable Variables

I have a unique API that manages music playback. Instead of playing audio in the browser, it is done through a Discord bot. Achievement Goal https://i.stack.imgur.com/w3WUJ.png Parameters: current: indicates the current position of the track (e.g. 2:3 ...

How can I use jQuery to vertically align an element?

Here's my website: Take a look here! I have a menu on the left column that I want to center. Take a look at the image below for a better understanding of what I'm trying to achieve. https://i.stack.imgur.com/ZzprT.png Here is the JavaScript c ...

Is it possible to continuously loop and gradually fade the same image URL using JavaScript?

I have a dynamic image stored on my web server at example.com/webcam.jpg that is continuously updated by the server. My goal is to display this image on a static HTML page with a looping effect that smoothly transitions from the previous image to the upda ...