Achieve the effect of bringing the div and its contents to the top when hovered over, all while keeping

I have designed a popup that includes multiple boxes. I want the width of the box to expand and be visible over all content on the webpage when a user hovers over any ".deviceboxes". I tried using ".deviceboxes:hover" which worked fine for the first box in the row, but it messed up the layout when hovering over other boxes. How can I achieve this without disrupting the layout?

Here is the HTML content:

<div class="modal-body">
    <div id="leftsection">
      <div class="deviceboxes">
            <div id="boxlabel_NetworkDevice_97" class="title">NetworkDevice_97</div>
                <div id="NetworkDevice_97_1" class="cmds">Command 1</div>
                <div id="NetworkDevice_97_0" class="cmds">Command 2</div>
            </div>

      <div class="deviceboxes mrgnleft">
        <div id="boxlabel_NetworkDevice_9" class="title">NetworkDevice_9</div>
        <div id="NetworkDevice_9_1" class="cmds"Command_1</div>
        <div id="NetworkDevice_9_0" class="cmds">Command_2</div>
      </div>
    </div>
</div>

And here is the CSS code:

.modal-body{ overflow: hidden; position: relative;} 
#fetch_commands{ left: 34% !important; width:1000px !important; height:500px; overflow: hidden;}
#leftsection{ float: left; width: 730px; height: 400px; overflow-y: scroll; overflow-x: hidden; min-height: 200px;}
#rightsection{position: relative; width: 200px; height: 400px; overflow-y: scroll; overflow-x: hidden; margin-left: 10px; padding-left: 20px; }
.netDevices { width:98%; padding: 5px 0px 5px 5px; cursor: pointer;}
.netDevices:hover {background: #406BA3; color: #FFF !important; -webkit-transition: all 1s; -moz-transition: all 1s; -o-transition: all 1s;}
.processing{ background: #006002; color: #FFF;}
.success{ background: none; color: #006002;}
.failed{ background: node; color: #FF0A16;}

.deviceboxes{ float: left; width: 215px; height: 200px; border: 1px solid #666; overflow-x: hidden;-webkit-transition: all 1s; -moz-transition: all 1s; -o-transition: all 1s;}
.deviceboxes:hover{ position:absolute !important; z-index:999999; width:500px !important; -webkit-transition: all 1s; -moz-transition: all 1s; -o-transition: all 1s;}
.title{ width: 100%; text-align: center; background: #000; color:#FFF; padding:10px; cursor: pointer;}
.cmds{ width: 195px; text-align: left; background: none; color:#000; padding:2px; margin-left: 5px; cursor: pointer; overflow-x: hidden; white-space: nowrap;}
.mrgnleft{ margin-left:10px; }
.mrgntop{ margin-top:10px; }
.navbar-inner { min-height: 65px!important; }

Answer №1

Here are two straightforward adjustments you can implement:

  1. To account for the width increase from 215px to 500px, apply a negative margin so that subsequent elements return to their original position. In this scenario, the margin should be set to -285px (215-500 = -285px).

  2. Instead of utilizing position:absolute, switch to position:relative for all instances of .deviceboxes (not limited to hover) to maintain influence on the page layout. This adjustment ensures proper z-index functionality.

Additionally, it's sufficient to define the transition settings solely in the base state and not both in the hover state if they remain consistent. This optimization conserves data usage.

.modal-body {
    overflow: hidden;
    position: relative;
}
#fetch_commands {
    left: 34% !important;
    width:1000px !important;
    height:500px;
    overflow: hidden;
}
#leftsection {
    float: left;
    width: 730px;
    height: 400px;
    ...
    </pre>
<pre><code><div class="modal-body">
    <div id="leftsection">
        <div class="deviceboxes">
            <div id="boxlabel_NetworkDevice_97" class="title">NetworkDevice_97</div>
            <div id="NetworkDevice_97_1" class="cmds">Command 1</div>
            <div id="NetworkDevice_97_0" class="cmds">Command 2</div>
        </div>
        <div class="deviceboxes mrgnleft">
            <div id="boxlabel_NetworkDevice_9" class="title">NetworkDevice_9</div>
            <div id="NetworkDevice_9_1" class="cmds">Command_1</div>
            <div id="NetworkDevice_9_0" class="cmds">Command_2</div>
        </div>
    </div>
</div>

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

Manipulating Arrays with JQuery

Is there a way to create a map to send it as post-data using AJAX? For instance, I have an iterator each function where I need to do something like this: var map = []; ...each(function() { map[$(this).key()] = $(this).val(); }); Is there another syntax ...

Changing the Color Scheme of Twitter BootstrapRevamping the Color Palette

I am interested in updating the color scheme of a website that I modeled after this example: http://getbootstrap.com/examples/navbar/ So far, I have successfully changed the background color of the entire page using: body{background-color:#XXXXXX} Howev ...

Is there a way to automate the loading process when a file is uploaded to an HTML input field?

How can I upload a file via Ajax post in HTML without clicking the button? Currently, my code only works after clicking the bootstrap button. My current implementation is as follows: $(document).ready(function () { $("#but_upload").click(function () { ...

Displaying a JQuery notification when hovering over a link

I am having trouble getting an alert to pop up when I hover over a hyperlink using JQuery and Javascript. The hyperlink is inside an anchor within the main section of the HTML. Any assistance would be much appreciated. Here is my current code snippet: &l ...

What measures can be taken to stop links from disrupting the style of a Polymer site?

In Polymer, it seems that many styles are inherited from the surrounding document. For example, the code snippet below will display the icon and button with a white foreground color and adjust spacing: <paper-toolbar> <paper-icon-button icon=" ...

Transmitting form data inputted by the user to a modal that resides in the same component, all without the need for child or parent components or

In need of a solution where users can input answers to questions and have all the entered data displayed in a popup alongside the respective question. If a user chooses not to answer a question, I do not want that question or any related information to be ...

How can I iterate through each element of MySelector in the callback function of jquery-ui's draggable function?

When using: jQuery(MySelector).dragabble( start: function( e, ui ) { } ) In the start function: The start event provides $(this) with the current dragged element from MySelector. How can I loop through each element in MySelector to apply additional code ...

What are the best methods for adjusting the size of a game's

I create games using HTML5/CSS/JS, but I am struggling to figure out how to make them scale to different screen resolutions. It seems like a simple task, but I can't seem to grasp it. SOLVED var RATIO = 480 / 800; // Initial ratio. function resize() ...

Prevent screen from loading without JavaScript using an overlay

Is there a way to darken and lock the page, preventing clicking or scrolling, while displaying white text notifying the user that JavaScript is not enabled? I understand that the recommended approach is to gracefully degrade all elements when JavaScript i ...

apply a border-radius to the top right corner only without affecting the other sides or background

I have been working on creating the top right triangle design shown in the image. However, I encountered an issue where applying border radius seems to affect all sides instead of just one as intended. Despite using border-top-right-radius: 5px;, I am not ...

Having trouble receiving a response from $.get method in localhost using jQuery

Attempting to send a GET request using jQuery in order to receive a dynamically determined namespace page. The index page (in Jade) contains a text input form that is being used by this script: script(src="http://code.jquery.com/jquery-1.11.1.js") script( ...

Personalized text hues for your WordPress product page

As someone who is new to all of this, please keep that in mind :/ I decided to remove the "add to cart" button from my theme (blocksy) so I could insert my own buttons within the product page under the "short description" text. I needed two "download" but ...

Is there a more efficient approach to applying a basic function to multiple elements within a DIV and having it activate only upon a click event using jQuery?

This solution works, but I am looking for a more professional approach in order to adhere to the principle of "don't repeat yourself." $("document").ready(function(){ $(".child").each(function(index){ $(this).click(func ...

Is there a way to reset or clear the queue using Jquery?

I've encountered an issue with my code that only triggers two functions once when a button is clicked. Subsequent clicks do not activate the functions. I'm looking for a way to reset the queue so that both functions are fired every time I click t ...

The functionality of the disabled button is malfunctioning in the Angular 6 framework

Just starting out with angular 6 and I'm using formControl instead of FormGroup for business reasons. app.component.html <button class="col-sm-12" [disabled]="comittee_Member_Name.invalid && comittee_Member_Number.invalid && c ...

Getting to grips with accessing HTML elements within a form

<form name="vesselForm" novalidate> <input type="text" id="owner" name="ownerEdit" required ng-blur="vesselForm.btnCC.attr('value', 'Change Customer')"/> <input type="button" name="btnCC" value="Customer" /> </fo ...

Enhance your website navigation with Bootstrap Scrolling Nav: maintain consistent section heights and highlight the active

Can you help me with an issue I'm having when clicking on the <a> link in the navigation? The anchor point seems to be misplaced as the section headline (<h2>) is not visible. Is there a way to highlight the <a> links, perhaps by add ...

List of JQuery Elements

Being able to reference my JQuery selectors from an array instead of individually would be much more convenient. I thought that by using the following logic, I could achieve this: var reference = $('.class'); reference[0].<function>; As ...

Customize your website with CSS and Bootstrap: create a transparent navbar-wrapper

Is there a way to make the menu bar background transparent without affecting the transparency of the text on the menu bar? This template is based on Twitter Bootstrap carousel. In this specific line, <div class="navbar navbar-inverse navbar-static-to ...

Module fails to load in the proper sequence

As a .NET developer who is relatively new to modern client-side web applications, I am currently working on developing an Angular2 charting application using Chart.js. The modules are being loaded with SystemJS. Below is the content of my systemjs.config. ...