One particular item in the list does not conform to the same formatting as the others

Having a formatting issue with the indexLink when populating an unordered list with links. Can't seem to dedent it properly no matter what I try. Here's the javascript snippet:

function addCrumb() {
  /* reads from localStorage and determines which links go where */
  for (i = hIndexCount; i >= 0; i--) {
    if (localStorage.history.charAt(i) === "a") {
      ridingHood[i] = '<a href="aboutme.html"><span class="aboutMeLink">About Me</span></a>';
    } else if (localStorage.history.charAt(i) === "e") {
      ridingHood[i] = '<a href="experiments.html"><span class="experimentsLink">Experiments</span></a>';
    } else if (localStorage.history.charAt(i) === "i") {
      ridingHood[i] = '<a href="../index.html"><span class="indexLink">Sprit Index</span></a>';
    } else if (localStorage.history.charAt(i) === "p") {
      ridingHood[i] = '<a href="professional.html"><span class="professionalLink">Professional</span></a>';
    } else if (localStorage.history.charAt(i) === "s") {
      ridingHood[i] = '<a href="school.html"><span class="schoolLink">School</span></a>';
    }
  }

  //window.alert(ridingHood + " " + h + " " + localStorage.history.length);

  displayCrumbs();
}

function displayCrumbs() {
  ridingHood[hIndexCount] = '<li><span class="firstLink">' + ridingHood[hIndexCount] + '</span></li>';
  ridingHood[hIndexCount - 1] = '<li><span class="secondLink">' + ridingHood[hIndexCount - 1] + '</span></li>';
  ridingHood[hIndexCount - 2] = '<li><span class="thirdLink">' + ridingHood[hIndexCount - 2] + '</span></li>';
  ridingHood[hIndexCount - 3] = '<li><span class="fourthLink">' + ridingHood[hIndexCount - 3] + '</span></li>';

  /* cycles through and displays each ridingHood index */
  for (i = hIndexCount; i >= 0; i--) {
    document.getElementsByClassName("history")[0].innerHTML += ridingHood[i];
  }
}

Here's the HTML snippet:

<nav>
    <ul class="history">

    </ul>
</nav>

Thank you for your time! Feel free to check out the live example on the student server here!

Answer №1

Within the index.css file, you currently have the following CSS:

.aboutMeLink, .schoolLink, .experimentsLink, .professionalLink {
  height: 4.2em;
  width: 0%;
  z-index: -1;
  position: relative;
  margin: auto;
  border-left: 6px solid rgba(255, 255, 255, 0);
  border-right: 6px solid rgba(255, 255, 255, 0);
  -webkit-transition: background .6s ease-in-out, width .4s ease-in-out, border-color .2s ease-in-out .5s;
  -moz-transition: background .6s ease-in-out, width .4s ease-in-out, border-color .2s ease-in-out .5s;
  -ms-transition: background .6s ease-in-out, width .4s ease-in-out, border-color .2s ease-in-out .5s;
  -o-transition: background .6s ease-in-out, width .4s ease-in-out, border-color .2s ease-in-out .5s;
  transition: background .6s ease-in-out, width .4s ease-in-out, border-color .2s ease-in-out .5s;
}

It appears that the .indexLink class is missing from this styling, resulting in different styling for that particular link. Consider adding the .indexLink class to ensure consistent styling across all links.

Alternatively, you may create a common class like sidebarLink and apply the styling to all elements with this new class for a more streamlined approach.

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

Different boolean variable assigned to every item in v-for loop

I am working on creating a custom play/pause button for my audio elements, and here is how I have implemented it: <div v-for="(post, p) in post_list"> <!-- ... --> <!-- ... --> <!-- ... --> <v-avatar v-i ...

Having trouble with Node.js GET request functionality not functioning properly

I've been encountering difficulties with loading a page using Node.js. While my Node.js Application code functions properly when attempting to load other resources such as www.google.com, it seems to encounter issues specific to the domain name www.eg ...

Having trouble debugging a website remotely? Dealing with a JSON problem specifically in IE8

Currently, the website is functioning flawlessly on various machines except for those used by the client in Africa. Unfortunately, I have no way of accessing his specific machine due to geographical constraints. The client has limited IT knowledge, and we ...

Convert data in JavaScript and send it as a string in PHP

I'm currently facing a small issue with my JavaScript code. Specifically, I am using AJAX and attempting to retrieve a variable in PHP. Everything seems to be working fine except for the "param" data. Below is the snippet of my code: $('#sign ...

Having trouble accessing variables using the put method in Laravel with XMLHttpRequest

I am struggling to save my image data using XMLHttpRequest. Although I can send json data and see them in the developer console, I am unable to access them on the server side as the $request appears to be null. Below are snippets of my JavaScript code: ...

Dynamic video autoplay with a hover effect using Bootstrap 3

I am looking to create a hovering effect on an autoloop video similar to what is seen on this website - This specific section of the website demonstrates the effect I am trying to achieve. Prior to hovering, the autoloop video has an overlay displayed on ...

Issue encountered: Framer Motion animation is not functioning properly on elements that are rendered using the map()

I'm attempting to create an animation similar to this: https://drive.google.com/file/d/1WQCg7j49xd5XfuaYuC2YFQCUU-UXassp/view?usp=sharing Here's the code I have: <motion.div layout className="grid grid-cols-2 md:grid-cols-3 gap-8 py-10&q ...

A guide on incorporating JavaScript variables within a GraphQL-tag mutation

I'm having trouble consistently using javascript variables inside graphql-tag queries and mutations when setting up an apollo server. Here's a specific issue I've encountered: gql` mutation SetDeviceFirebaseToken { SetDeviceFirebaseTok ...

The proper way to close file descriptors on a terminated HTTP connection in a Node.js environment

I am currently experimenting with Node.js, where I am attempting to stream files from the filesystem over HTTP. However, my experience on an OS X Lion machine has been hindered by a buggy Apache Bench (ab) app that prematurely aborts connections. This issu ...

Obtain individual information from XML

After fetching data from the server using ajax, I am looking to retrieve only a specific part of the data which is the name. How can I modify my code to achieve this? const url = 'https://jsonplaceholder.typicode.com/users' const xhr = new XMLH ...

Cast your vote once for each post within the Angular application

Currently, users are only able to vote up or down once in general. I would like to allow users to vote up or down once per post. <div ng-repeat="post in posts | orderBy:'-upvotes'"> <span class="glyphicon glyphicon-thumbs-up" ...

What is the best way to align the navbar items at the center in Bootstrap when mx-auto is not working?

<nav class="navbar navbar-expand-sm navbar-light"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls ...

ES6 syntax makes use of variables enclosed in curly braces

Could you explain the impact of the bracket followed by a braces combination (for example, ({user}) below)? promise1.then(user => ({user})); ...

Control input for filtering and searching using Bootstrap

My goal is to create a search and filter user input field. I found an example on an old bootstrap page that showcases exactly what I need, but I'm facing some issues with displaying the results. Here's the Bootstrap example page. The search bar ...

What is the best way to manage a 301 redirect from a current page to a new page within my index.js script?

Hello everyone, hope you're having a great Friday! I'm looking for advice on the best approach to handle a 301 redirect in node.js from an existing file to another file. Let's say I currently have a file called /contact router.get('/con ...

What steps can be taken to provide accurate information in the absence of ImageData?

Utilizing a JS library to convert a raster image into a vector, I encountered an issue where the library returned a fill of solid color instead of the desired outcome. I suspect that the problem lies within the ArrayBuffer. The process of loading an imag ...

Controlling the order of class specification prioritization

I have a situation with DOM elements that possess both the foo and bar classes: <div class="foo bar">...</div> I am looking to manage the priority between them. Referring to the W3C specification on this matter, I considered that appending ad ...

What do the letters enclosed in brackets signify?

I am currently working with a library known as Monet.js, and within the documentation, there are descriptions that look like this: Maybe[A].map(fn: A => B) : Maybe[B] I am unsure of what the letters inside the brackets stand for. Is there anyone who c ...

Is there a way to keep this table fixed in place as the user scrolls?

Is there an alternative way to fix the content on the header so that it remains visible on the screen until the next table, even when scrolling? I've tried using position: sticky and top: 0, but the header still scrolls past. I have checked for any ov ...

Is it possible to adjust the width of the comment box on the Facebook "Like" button?

Is there a way to set the width of the comment box that appears after clicking the Facebook "Like" button? I know how to adjust the width of the button itself and related content, but can't find any options for the comment box: I've tried overri ...