When clicking on a name in the leaderboard, receive comprehensive information in a separate window or a popup

I have a unique leaderboard setup here featuring four JavaScript tabs that showcase different leaderboards when clicked. To run the code snippet, please see below:

$(document).ready(function() {
  $('.tab a').on('click', function(e) {
    e.preventDefault();
    var _this = $(this);
    var block = _this.attr('href');
    $(".tab").removeClass("active");
    _this.parent().addClass("active");
    $(".leadboardcontent").hide();
    $(block).fadeIn();
  });
});
*,
*:before,
*:after {
  box-sizing: border-box;
}
html {
  overflow-y: scroll;
}
<!-- Rest of CSS code is omitted for brevity -->
/*--------------------
            Leaderboard
            --------------------*/
<!-- Leaderboard CSS is included here -->

</div>
<!-- /form -->

<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>

Although this leaderboard functions flawlessly, I aim to introduce new functionality.

Issue: How can I exhibit individual details of a person from the leaderboard upon clicking their name? I've provided an example link showcasing a similar behavior that I intend to implement.

Example link: http://codepen.io/HannahF/pen/EKrbad

In the given example, clicking on a person's name reveals detailed information about them. Can we replicate this behavior on my page?

If possible, kindly assist with achieving this feature.

Answer №1

Hey there! I've got just the thing for you, buddy! Take a look at this CodePen link. All you need to do is display a div with the information you want to show. I've already linked it to an on-click event, but feel free to enhance it with additional transitions and CSS to make it even more appealing. And don't forget to personalize details like the person's name, points, and other information based on the user who is clicked. Hope this solution works for you :)

Note: If you have some spare time, I recommend checking out the Bootstrap modal here.

Answer №2

Instead of altering the entire page, consider displaying the details in a pop-up window or having them appear on the side when hovering over a name.

Answer №3

Please take a look at this live Demo - Jsfiddel

HTML Code:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

<div class="form">

  <ul class="tab-group">
    <li class="tab active"><a href="#weeklylb">Weekly LB</a>
    </li>
    <li class="tab"><a href="#overalllb">Overall LB</a>
    </li>
    <li class="tab"><a href="#defaulters">Defaulters</a>
    </li>
    <li class="tab"><a href="#co-workers">Co-Workers</a>
    </li>
  </ul>

  <div class="tab-content">
    <div id="weeklylb" class="leadboardcontent">

      <div class="leaderboard" id="leaderboard">

        <ol>
          <li data-toggle="modal" data-target="#myModal">
            <mark>Weekly LB</mark>
            <small>315</small>
          </li>
          <li data-toggle="modal" data-target="#myModal">
            <mark>Brandon Barnes</mark>
            <small>301</small>
          </li>
          <li data-toggle="modal" data-target="#myModal">
            <mark>Raymond Knight</mark>
            <small>292</small>
          </li>
            ... <!-- More list items -->
        </ol>
      </div>


      <svg style="display: none;">
        <symbol id="cup" x="0px" y="0px" width="25px" height="26px" viewBox="0 0 25 26" enable-background="new 0 0 25 26" xml:space="preserve">
         ... <!-- SVG path content -->
        </symbol>
      </svg>
    </div>
    <!-- Other lead board content sections -->


  </div>
  <!-- tab-content end -->

</div>



<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
     ... <!-- Modal content -->
    </div>
  </div>
</div>
<!-- Form end -->

<script src=https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js></script>

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

Javascript (JS):

$(document).ready(function() {
  $('.tab a').on('click', function(e) {
    e.preventDefault();
    var _this = $(this);
    var block = _this.attr('href');
    $(".tab").removeClass("active");
    _this.parent().addClass("active");
    $(".leadboardcontent").hide();
    $(block).fadeIn();
  });
});

CSS Styling:

*,
*:before,
*:after {
  box-sizing: border-box;
}
html {
  overflow-y: scroll;
}
body {
  background: #c1bdba;
  font-family: 'Titillium Web', sans-serif;
}
... <!-- More CSS styles and rules -->

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

Removing the "<!doctype html>" tag from a document using cheerio.js is a simple process that involves

Is there a way to remove and <?xml ...> from an HTML document that has been parsed by cherio.js? ?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-tran ...

Having trouble with the Bootstrap accordion collapse not expanding as expected using CSS

I've been trying to make these collapsibles work, but I'm having no luck. I'm not sure what I'm doing wrong here. I thought it could be my PHP code, but everything seems fine when loading text from the database. Any assistance would be ...

What is the best way to verify if a class attribute includes a specific class or not?

Below is the code snippet provided. The code fetches all classes and then checks for the presence of the 'mat-checked' class. pmanage.no_additional_cost().last().invoke('prop', 'class').then((Class) => { let ...

Is there a way to perfectly center text both vertically and horizontally to the right side of an image?

I'm working on developing a mobile website using jQuery Mobile and I want to include images in my "collapsible" elements. Here is the code I am using: <div data-role="collapsible" data-collapsed="true"> <h3><img src="image ...

Sending Data to PHP Script Using AJAX Without Submitting the Form

Seeking assistance with capturing onclick event for image deletion. I have a code snippet below that triggers an 'onclick' event for deleting images which calls the 'delete.php' script to remove physical images from the server. <sc ...

Hiding a row in AngularJS after changing its status can be achieved by utilizing the

I need help hiding a clicked row after changing its status using angularjs. Below is the code I have written, can someone guide me on how to achieve this? table.table tr(data-ng-repeat="application in job.applications", ng-hide="application.hideApplic ...

How to resolve useState problem in useEffect when state is not null

Encountering issues with maintaining state in TypeScript React. A Child component passes a 'terminal' object to the Parent via a function called returnTerminal(). This 'terminal' object is then stored as a useState variable named _obje ...

Printing the result of an SQL query in Node.js without using braces

As a beginner in node.js with only a basic understanding of javascript, I apologize if I make any mistakes. I attempted to display the results retrieved by an SQL query in node.js using: <p>Users are " + util.inspect(results) + ".</p>" an ...

Issue with React tabulator ref being null after re-rendering

Utilizing Tabulator within React by employing the react-tabulator module has been a part of my development process. Now, I rely on 'ref' for the table component to execute actions such as downloading data or any other relevant activity. import R ...

Unable to load CSS styles from SCSS when rendering the view

I am having trouble loading styles on my webpage from SCSS. Below is the code from my Gulp.js file: // Compile and Automatically Prefix Stylesheets gulp.task('styles', function () { return gulp.src([ 'Content/styles/**/*.scss&apo ...

Guide on incorporating Vue components: implementing component 2 within the template of component 1

I'm a Vue beginner and struggling with how to use one component within the template of another or how to combine them in HTML. I've tried looking through the documentation and Stack Overflow but can't seem to figure it out. Currently, I am ...

The "Mongoose 'model is not a constructor' error" is causing issues

It appears that I am encountering a rather common error. Despite reviewing previous questions, none have been able to resolve my issue. The typical mistakes involve using module.export instead of module.exports, and initializing a new schema instance inste ...

Mastering the Art of Utilizing $(this) in jQuery

$(".item_listing").hover(function(){ $(".overlay_items").display(); },function(){ $(".overlay_items").hide(); } ); This is my jQuery code. I am trying to display the "overlay_items" div when the "item_listing" div is hovered ov ...

Converting an array of images into blob format and displaying it using PHP

I am attempting to convert an array of images into blob format and then send it to a PHP script for data processing. However, I am encountering an issue where the array of blobs is not being sent correctly, and I am unsure why this is happening. Here is my ...

Steps to include a HTML webpage within another page

I need assistance with a scenario involving two separate HTML pages on different servers. Merchant Form - Server A Payment Form - Server B Here's the desired scenario: The user completes all necessary fields on the Merchant Form and clicks submit. ...

Tips for sharing data between two components

In my project, I have a customized Shared Component which consists of an input search bar with a "continue" button. This Shared Component is being utilized within two other components - the buy component and sell component. The challenge I am encountering ...

Place a small image within a list item to ensure it matches the height of the list element

I need help aligning images to the right within list elements. The images are squares with equal height and width, and I want them to fit snugly within the height of the list element on the right side. My HTML code is quite simple for now (see example bel ...

Displaying special characters in an HTML TextArea

I am facing an issue with displaying a particular character on a textarea: … My website is set to UTF-8 encoding, including the meta header and file encoding. The database, table, and fields are all in UTF-8 as well, since it is the default encoding. I ...

How to troubleshoot syntax errors when using the delete function in Three.js within Eclipse

When using the Javascript Library Three.js, it is important to note that the delete keyword can be used as an object property. While this is valid under ECMAScript 5 standards, Eclipse currently only supports ECMA 3. As stated in the Mozilla reference, re ...

Exploring ways to traverse a foreach loop based on a specific array size

Currently, I am utilizing two distinct for-each loops which are outlined below: <div id="filterarea" data-bind="foreach: { data: filters, as: 'filtercategory' } "> <ul data-bind="foreach: { data: Refiners, as: 'refiner' ...