Select Additional Component in Empty Area (Using Angular.js with HTML, JS, CSS)

In my ng-repeat, elements are highlighted on hover of the main div and a lightbox appears upon clicking an element. However, there is empty space below each element where cursor changes to pointer and lightbox opens. This phantom area is causing a false scroll bar to appear. See image here:

https://i.sstatic.net/4cbLY.png

I marked the issue in paint since cursor doesn't show in screenshots. An unintended selection box appears when clicked on the empty space as shown below:

https://i.sstatic.net/S5LSI.png

This faulty behavior occurs only in the template for this tab:

<div class="container-fluid col-md-12 learning-container" id="badge-popup-container">
        <div class="row">
            <div class="col-md-1"></div>
            <div class="col-md-4" id="track-progress-div">
            <h3 class="tile-header">Track - {{currentTrack}}</h3>
            <br>
            <span id="progress-text">Progress</span>
            <span id="progress-number-text"> {{trackProgress}}% </span>
            <md-progress-linear md-mode="determinate" value="{{trackProgress}}" id="track-progress-bar"></md-progress-linear>
        </div>

        <div class="col-md-7"></div>
    </div>

    <br>

    <div class="row">
        <div class="col-md-1"></div>
        <div id="badges-div" class="col-md-10">
            <h3 class="tile-header" id="badge-display-title">Your Badges</h3>
            <div class="badges-table">
                <div ng-repeat="badge in earnedBadges" class="table-badge-div" ng-click="showBadge($event, badge)">

                    <img ng-src="images/{{badge.image}}" class="badge-card-image">
                    <div class="badge-card-bottom">
                        <p class="badge-card-title">{{badge.name}}</p>
                    </div>
                    <p class="badge-card-points"><b>{{badge.points}}</b></p>
                    <p class="badge-card-date"><b>{{badge.earnedDate}}</b></p>
                    <img src="images/all_white.png" class="badge-highlight-image">
                </div>
            </div>

            <div class="col-xs-1"></div>
        </div>

    </div>
</div>

The problem resides in the second row, specifically with the 'all_white' image used for highlighting cards on hover.

Browser used: Google Chrome.

Any insights on why this erroneous selection box appears? How can I remove it?

Edit:

Here's the CSS as requested.

Edit 2:

Initially, the wrong CSS was shared. Here's the correct one. Upon inspecting the empty space, browser points to the table-badge-div, indicating it occupies that space.


(Insert corrected CSS code here)

Answer №1

After some troubleshooting, it appears that the culprit causing the scroll bar issue was the highlight image. By setting display: none on the image, the problem was resolved.

To fix this issue, I made adjustments to the positioning of the table-badge-div elements by adding position:relative, and also specified position:absolute and bottom:0px for the transparent highlight-image. These changes should ensure everything functions properly now.

.table-badge-div {
    position:relative; /* New addition */
    margin-top: 30px;
    margin-left: 30px;
    box-sizing: border-box;
    display: inline-block;
    width: 190px;
    height: 80%;
    background: linear-gradient(to bottom left, #5b5b5b, #adadad);
    box-shadow: 7px 7px 5px 10px rgba(80, 95, 119, .4);
}

.badge-highlight-image {
    opacity: 0;
    position: absolute; /* Updated */
    width: 100%;
    height: 100%;
    bottom: 0px; /* Modified */
}

For a live demonstration, you can check out the updated version on Plunker: https://plnkr.co/edit/sRZWpsQ1DmBoKKwSiGBS?p=preview

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

Troubleshooting problem with scrollbar in HTML table within a div element

I'm utilizing Bootstrap for the majority of my CSS. I've split a section into two columns, with the left column displaying a table with data and the right side featuring a Google map. The issue arises when the table row grows, as it doesn't ...

Exploring the angular js repeater component's context menu options

In one of my current projects, the client has specifically requested a right-click menu feature. However, the challenge lies in ensuring that the function triggered by the menu options has access to relevant information from the model. For instance, you ...

The jQuery datatable is functioning correctly, however the button is rendered but is not

Originally, I have a datatable which can be viewed at the following link: The functionality I am experiencing is related to a "DISABLE" button that toggles to "ENABLE" and vice versa upon clicking. However, if you click on the same button after it has alr ...

Tips on initiating a $http.get request every second using a service

I am working on an angular application that includes a $http.get request. While it currently functions properly, I need it to be executed every second in order to retrieve new data. Service: angular.module('adf.widget.liveCharts') .service(&a ...

Is there a way to display my current connected clients to a new client using socket.io?

I am currently working on a project involving socket.io. Upon connecting to a new socket, my input username is displayed in the "usersDiv" where all clients are supposed to be listed. However, I've noticed that when I open another tab and input my nam ...

Position the "SHARE" button at the exact center of both the vertical and horizontal axes of an image (activating when the cursor hovers over it)

I'm currently working on a project and I really like the design on Fancy: . When you hover over an image, the background darkens and a button appears in the front. What I want to achieve is similar, but with a SHARE button instead. I have the image d ...

Maintain a consistent size for the material UI drawer, preventing it from resizing when the content size fluctuates

Incorporating Material UI into my project, I decided to use a drawer for navigation. However, within the drawer, there are Collapsible lists that expand when clicked. The issue arises when the list text items are lengthy, causing the drawer to unexpectedly ...

Update a JavaScript variable with fresh information and then execute JSON parsing

I have implemented this code to display a Verite Timeline on my webpage: <div id="timeline-embed"></div> <script type="text/javascript"> var timeline_config = { width: "100%", height: "100%", debu ...

Executing a function from an external .js file using Node.js

Hey there! I have a Nodejs application running on Heroku and I am looking to utilize functions from an external file. However, I'm not quite sure how to go about it. The contents of my external tool.js file are as follows: var Tool = {}; //tool name ...

How can I implement two unique custom scrollbars on a single webpage?

I'm attempting to customize the scrollbar for a scrollable div separately from the scrollbar for the entire window. Despite my efforts, I haven't been successful in achieving two different colored scrollbars. *{ margin: 0; padding: 0; font-fam ...

Responsive design is achieved through the use of mobile media

I am seeking assistance with optimizing my website for mobile devices as it currently displays like the image below. Here are the solutions I have considered so far: Duplicating the 680 lines of CSS within the same document between @media only screen ta ...

Integrate Vue.js into a traditional multi-page application

I recently integrated Vue.js into my CMS-backed website to handle a specific UI feature involving tabs that switch content on the page. Now, I'm looking for a way to make these tabs deeplinkable so that a specific tab is active when the page loads. Wh ...

The product has been taken out of the cart, yet it has not been reinserted into the cart

The product disappears from the cart after clicking on Add to Cart, but it doesn't reappear when clicked again. //function for adding only one item to cart document.getElementById('btn1').onclick = function() { addItemToCart() }; fun ...

Express encountered an error: NODE_ENV is undefined

This section contains my index.js code: var express = require('express'); var app = express(); var compression = require('compression'); var path = require('path'); app.use(compression()); app.set('port', (process. ...

Tips for concealing a collapsible navbar menu upon clicking elsewhere (Bootstrap 5)

I am trying to create a collapsible navbar menu: <div class="collapse navbar-collapse" id="navbarCollapsible"> .. menu items .. </div> My goal is to hide the menu whenever a user clicks outside of it (not just when click ...

Utilizing JSON Objects to Populate a Knockout Form

I am looking to populate a form using knockout data-binding from a JSON object. I currently have the values hardcoded in my knockout setup, but what I really want to achieve is dynamically populating the form based on a JSON object. Here is a link to my ...

Trouble encountered while refreshing a <div> element using AJAX functionality

My web page is being dynamically generated by scriptA.php. Every 5 minutes, the content of the #WatchContainer div element needs to be updated. This content is created by scriptB.php. I have included scriptB.php in scriptA.php using "include" and a variabl ...

Having trouble retrieving POST data with NodeJS/Express and an HTML form?

I have encountered an issue in my application where I am unable to extract the posted data from req after performing an action pointing to a nodejs endpoint. Despite successfully executing the action, when attempting to access the posted data from req, I a ...

Tips for utilizing the vuetify readonly prop while enabling the selection menu

In my project, I have a grid containing v-autocomplete components with the multiple attribute. To maintain clean formatting, I decided to show only a shortened version of the content using the selection slot feature provided below: <v-autocomp ...

The Jasmine test does not instantiate a new class instance

I've been working on incorporating a Jasmine test into my JavaScript program (which is just a game), but I'm running into an issue where new instances aren't being created. I'm hoping that someone could help me troubleshoot and identify ...