What are the steps to make the chosen title and its content active while deactivating the others?

I am currently developing a website for an educational institution that includes schools with subdivisions such as matric, CBSE, and state board, as well as a college. My goal is to create a user interface where clicking on a specific stream (such as matriculation) will activate the corresponding schools, while deactivating the others. I have implemented this using pills and have labeled each institution accordingly.

Here is the HTML structure I have used:

<section class="ourscl" id="school">
    <div class="container">
    <div class="text-center">
      <h2 class="hdng"><span class="schools-title">Our Schools</span></h2>
      <h4 class="italic-line"> 100+ schools with world class education </h4>
      <div class="plus_image"><img class="repeat_image"></div>
      <ul class="nav nav-pills nav-justified navbar-default" style="color:white;margin-top:30px;margin-bottom:30px">
        <li class="active brdrlft tab-wid font-sz"><a href="#mtrcscl1" data-toggle="pill">Matriculation Stream</a></li>
        <li class="brdrlft tab-wid font-sz"><a data-toggle="pill" href="#cbse">CBSE Stream</a></li>
        <li class="brdrlft tab-wid font-sz"><a data-toggle="pill" href="#hgrscl">State Board</a></li>
        <li class="tab-wid font-sz"><a data-toggle="pill" href="#clg">B.Ed College</a></li>
      </ul>
      <div class="tab-content" style="margin-top:30px;margin-bottom:30px">
        <!-- School details go here-->
      </div>
    </div>
  </div>
  </section>

I have also styled the interface using the following CSS:

.ourscl .navbar-default{
    background-color:rgb(222, 35, 41) !important; /*rgb(144,21,14)!important;*/
}
/* Other CSS styles go here */

The link to the JSFiddle demonstrating the implementation can be found here. Please adjust the output box size for a better view of the columns, as shown in the attached image.

My desired output should resemble the image shown in this link. When a specific stream is selected, only the schools associated with that stream should be displayed and arranged in the top row. Any guidance or suggestions to improve this functionality would be greatly appreciated.

Answer №1

To replicate a comparable outcome using CSS, you can incorporate the following code snippet for hovers:

.tab-content:hover .col-sm-3:not(:hover) { opacity: .5; }

Alternatively, for a click event to establish a lasting state for the links, exploring a JavaScript method to toggle a designated class on both the container and the active element would be advisable.

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

Calculate the total cost for each row in a table by multiplying the quantity and price using jQuery, then display the result

I'm encountering an issue with my table row calculations involving price and quantity. The calculation results show up correctly in the console, but when I try to display them back on the table, the total sum of the first row gets duplicated into all ...

The text following a table is spilling into the table because it is too big to fit within the designated div

I've been searching for a solution to this issue (it's a common problem), but nothing I've attempted has resolved it. Currently, I am using jQuery Mobile. Below is the code snippet in question: <div style="width:100%; height:220px;"> ...

"JQuery's selector is failing to locate elements once they have been loaded through an

I am facing an issue where jQuery selectors are not working on elements loaded from the server via Ajax requests, but they work fine in normal mode. $('#myid').change(function(){ alert('OK!'); }); <select id="myid"> <optio ...

Updating a table without the need for a button in PHP and AJAX with an Excel-inspired approach

I'm facing a scenario where I need to dynamically update the contents of a table row. To achieve this, I want the cell to transform into a text box when clicked. Here's how I implemented it: <td contenteditable></td> After making ch ...

I'm unable to successfully include a download link for a PDF file stored locally

Looking to provide a download link for my resume on my website. Here's the code I'm using: <a href="My Resume.pdf" class='download' download="Resume PDF">Download CV</a> Despite using what I believe to ...

Utilize jQuery to access the text content of the desired element

Looking to extract the text from a targeted element within an unordered list <ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ul> using this code snippet $('ul').click(function() { th ...

Tips for sending jQuery variable with an Ajax GET call?

I have a jQuery slider that generates values. Now, I need to pass these variables to a URL in the format using an Ajax get request. In my index.php file, I have the following JavaScript code which assigns values to the variables 'rich' and &apo ...

What is the best way to wrap the countdown numbers with <span> tags?

I have implemented the following countdown script: var clock = document.getElementById("timeleft"), tdy = new Date(1494979200000); countdown.setLabels( '| <span class="time-label">second</span>| <span class="time-label">minute< ...

Solving the issue of unnecessary white space when printing from Chrome

Whenever I print from Chrome, there seems to be extra space between lines in the middle of a paragraph! Here is an image showing the difference between print emulation and print preview This excess space is always in the same position on various pages an ...

Is there a way to enable scrolling in the background when a modal is open?

I recently designed a bootstrap modal, but I encountered an issue where when it appears, the vertical scrollbar on the background page becomes disabled and the content shifts to the right by the width of the scrollbar. I want to prevent this content shif ...

Guide to implementing a variable delay or sleep function in JQuery within a for loop

I've noticed that many people have asked similar questions, but none of the solutions provided seem to work in my specific case. My goal is to incorporate a delay within a for loop with varying time lengths. These time lengths are retrieved from an a ...

Creating a line with CSS is a straightforward process that involves using properties

I am trying to achieve a yellow line effect similar to the image shown using CSS. I have managed to create line holes so far, but I'm struggling with creating vertical straight lines. Here is an example of my current code: https://i.sstatic.net/MqRUE ...

Unconventional border effect while hovering over image within navigation container of Bootstrap

Whenever I hover over the image inside the navigation bar, there is a strange white/gray border that appears. It's quite annoying. Does anyone know how to remove this border? Here is the code snippet causing the issue: <ul class ...

Are there any jQuery Context Menu plugins clever enough to handle window borders seamlessly?

After reviewing UIkit, as well as some other jQuery Context Menu plugins, I have noticed that they all tend to exhibit a similar behavior: The actual menu div renders outside the window, causing valuable content to be hidden from view. Is there a way to ...

The background color is not displaying correctly on the <div> element

body { background-color: #FFFDEC; } .header { position: fixed; top: 0; left: 0; height: 50px; width: 100%; background-color: #04A7A6; margin: 0; display: block; z-index: 10; } .headermenu { xposition: fixed; ...

The animated Ajax loader image is not showing up on Internet Explorer 8

After reading numerous posts, none have been able to solve my issue. To address the problem, I included an IMG tag with a style attribute (visibility:hidden) for an ajax loader gif on the page. Additionally, event handlers were added for two jQuery ajax e ...

Styling is applied by Bootstrap to inputs in a form that are not required

I am currently working on validating a form for empty fields using Bootstrap. When submitting and validating the form with the form.checkValidity() method, I noticed that even the non-required fields are being styled as if they are required. Is this normal ...

Prevented: Techniques for providing extra cushioning for a button, but with the condition that it contains an external icon

How can I apply padding to a button only if it contains an external icon? If the button has an external icon, I want to give it padding-right: 30px (example). However, if there is no external icon present, then the button should not have the 30px padding. ...

Step-by-step guide on constructing a table using jQuery datatables featuring row child functionality

I have implemented jQuery datatable with Ajax. The server running Laravel returns a JSON in the following format: { "draw":0, "recordsTotal":201 ,"recordsFiltered":201, "data":[{ "id":"1", "numsocio":"1", "identificacion":"9999999999", "nombre":"Anna, "a ...

The issue with React select right-to-left (RTL) functionality is that it

When using react select, I include isRtl as a prop like so: <Select onChange={handleChange} isRtl isMulti options={colourOptions} /> However, only the input receives the rtl direction style and not the options. How can I ensure that both the input a ...