Revealing information through a smooth leftward and upward sliding motion

I designed a unique animation where a small box slides to the left and then downwards, revealing content upon hovering: http://jsfiddle.net/7n9jxo9c/3/

Now, I am looking to modify it so that the box slides to the left and opens upwards. This way, the content will be displayed above the X symbol.

HTML:

<div class="wrap">
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
</div>
<div id="item_add">
    <header>X</header>
    <div class="body">
        Content
    </div>
</div>

JS:

$(document).on('mouseenter', '.item', function( event ) {
    var menu = $('#item_add');
    var item = $(this);
    menu.css({ "top": item.offset().top + 35 }).show();
});

CSS:

.item {
    border: 1px solid #e2e2e2; 
    margin: 6px;
    padding: 0px 10px 0px 10px;
    position: relative; 
    height: 40px;
    }
.wrap {
    margin-left: 8em;
}
#item_new {
    border: 1px dashed #C0C0C0 !important;
    background: none repeat scroll 0% 0% #F7F7F7;
    display: block;
    height: 2.2em;
    margin: 6px;
    padding: 0px 10px;
    position: relative;
}

#item_add {
    display: none;
    position: absolute;
    left: 5.5em;
    width: 2em;
    border: 1px solid #ddd;
    background-color: #f7f7f7;
    color: #aaa;
    padding: 0px 6px;

    -webkit-transition: width 200ms ease-in-out 200ms, left 200ms ease-in-out 200ms;
       -moz-transition: width 200ms ease-in-out 200ms, left 200ms ease-in-out 200ms;
        -ms-transition: width 200ms ease-in-out 200ms, left 200ms ease-in-out 200ms;
         -o-transition: width 200ms ease-in-out 200ms, left 200ms ease-in-out 200ms;
            transition: width 200ms ease-in-out 200ms, left 200ms ease-in-out 200ms;
}

#item_add:hover {
    width: 7em;
    left: .5em;

    -webkit-transition-delay: 0s;
       -moz-transition-delay: 0s;
        -ms-transition-delay: 0s;
         -o-transition-delay: 0s;
            transition-delay: 0s;
}

#item_add:hover .body {
    max-height: 100px;
    visibility: visible;

    -webkit-transition-delay: 200ms;
       -moz-transition-delay: 200ms;
        -ms-transition-delay: 200ms;
         -o-transition-delay: 200ms;
            transition-delay: 200ms;
}

#item_add .body {
    max-height: 0;
    overflow: hidden;
    visibility: hidden;

    -webkit-transition: visibility 0s ease-in-out 200ms, max-height 200ms ease-in-out 0s;
       -moz-transition: visibility 0s ease-in-out 200ms, max-height 200ms ease-in-out 0s;
        -ms-transition: visibility 0s ease-in-out 200ms, max-height 200ms ease-in-out 0s;
         -o-transition: visibility 0s ease-in-out 200ms, max-height 200ms ease-in-out 0s;
            transition: visibility 0s ease-in-out 200ms, max-height 200ms ease-in-out 0s;
}
#item_add:after {
    content: '';
    width: 0px;
    height: 0px;
    -webkit-transform:rotate(360deg);
    border-style: solid;
    border-width: 5px 0 5px 7px;
    border-color: transparent transparent transparent #f7f7f7;
    top: 5px;
    right: -7px;
    position: absolute;
}
#item_add button {
    background: none repeat scroll 0px center #fff;
    padding: 0.2em 2em;
    margin: 3px .2em;
}

Answer №1

Consider using the 'Bottom' property on #item_add:after instead of 'Top'. Here is an example code snippet: http://jsfiddle.net/7n9jxo9c/9/

#item_add:after {
content: '';
width: 0px;
height: 0px;
-webkit-transform:rotate(360deg);
border-style: solid;
border-width: 5px 0 5px 7px;
border-color: transparent transparent transparent #f7f7f7;
bottom: 5px;
right: -7px;
position: absolute;}

Answer №2

It seems like there might be a misunderstanding in your question, but I believe using the bottom attribute instead of top could be more appropriate.

Here is an example of what I mean: http://jsfiddle.net/7n9jxo9c/8/

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

When the click event is triggered on the specified data target modal, it does not initiate the show

I am attempting to automatically launch a bootstrap modal depending on the presence of a specific query string in the URL. To achieve this, I use the trigger('click') method on the button responsible for opening the modal upon clicking: <a hre ...

Conceal a div depending on the selected radio button within a form

On my form, there are two radio buttons to choose from: one for "yes" and the other for "no". I am looking to create a feature that will hide a specific div on the form when the "no" option is selected. I have tried various JavaScript solutions found onlin ...

Tips on choosing just the selected checkbox values

In my CodeIgniter view, I am utilizing AJAX to post data to my controller. <script type="text/javascript"> $(document).ready(function(){ // find the input fields and apply the time select to them. $('#sample1 inp ...

JavaScript AlertBox is encountering an error with the message: "e is null."

I encountered an issue with a JavaScript Alert box that was previously functioning properly, but suddenly started displaying the following error: selenium.common.exceptions.WebDriverException: Message: [JavaScript Error: "e is null" {file: "file:///var/fo ...

Is there a way to automatically mount tabs without manually clicking on them?

Looking to optimize data fetches within a large tab container in React using material-ui. My goal is to have each Tab component handle its own data fetching, especially for Tabs with a greedyLoad prop that will be mounted upon the initial mounting of the T ...

Use Ajax to send multiple inputs sharing the same name

How are you doing today? I have a snippet of code to share: <input name='uno[]' value='gonzalo' /> <input name='uno[]' value='marcos'/> <input name='uno[]' value='martin'/> < ...

Triggering AWS Lambda functions with SQS

Utilizing AWS and SES for sending emails and SMS through a Lambda function using NodeJs. I need to make more than 1k or 500 REST API calls, with the average call taking 3 seconds to execute a single lambda function request. It is essential to process mul ...

Can a plugin be executed as a test?

I am currently using HTMLhint, however, I would like to have it run as a test rather than just through the command line plugin. Is there a way to achieve this and if so, how can I do it? I have searched online but haven't been able to find a solution ...

Execute a function multiple times within a loop

My task involves passing objects from an array to a function one at a time with a 1-second pause in between each item: async function CallingLabels() { if(id) { if(LabelNumbers) { LabelNumbers.forEach(async (Label) => { await ...

Steps to add a label below a text input field

Within a form, I have two text boxes and I would like to add labels underneath each of them for better clarification. To illustrate my idea, here is a simple diagram: (input1)<--space-->(input2) <label1><--space--><label2> Is ther ...

Contrasting the methods of invoking functions

It has come to my attention that (especially in the realm of React) there are multiple ways to invoke a function. I can point out: onClick={myFunction} onClick={myFunction()} onClick={()=>myFunction} onClick={()=>myFunction()} /*I'm uncertain if ...

Using AJAX to send data to a new URL via a POST request

I'm currently developing an event registration page that requires users to search for a specific item in the database in order to register for the event. To ensure that the form wizard sequence is not disrupted, the POST request needs to be submitted ...

Waiting for the result of an AngularJS promise

When I click a button in my AngularJS app, the following code is executed: if (!$scope.isChecked) { $scope.getExistingName($scope.userName).then(function (data) { $scope.userName = data; }); } // Additional processing code foll ...

Encountering a blank page after attempting to utilize useState within a button component in React

const CustomButton = () => { return ( <button>Click Me</button> ) } export default CustomButton import React from 'react' import './App.css' import CustomButton from "./components/button"; import Ima ...

Updating properties in a Higher-Order-Component within a React application

I'm diving into the world of higher-order components, also known as HOC: To experiment with this concept, I've crafted a sample HOC focused on handling GET requests for my component: import React from 'react'; import { Text } from &ap ...

Looking to specifically format numbers in the thousands using numeraljs, and not in the millions or billions

We are in need of a solution to only format numbers as thousands (k) and not as millions (m) or billions (b) using numeraljs. Currently, the library converts all formats. var number = 2000000; console.log(numeral(number).format('0a')); <scr ...

Leveraging jQuery for Custom Form Styling

.I prefer to utilize personalized form elements in my forms. <fieldset> <legend id="Cities">Urban Areas</legend> <div class="legend-underline"></div> <div class="filters" id="Cities-filters"> <div> < ...

Confirm the validity of decimal numbers with a precision of up to x digits beyond the decimal

Seeking to develop a Regular Expression Validation that satisfies the following criteria: a) Decimal numbers with up to 3 decimal places greater than zero b) Positive or negative non-zero numbers with up to 3 decimal places The mentioned items prefixed ...

The Vuetify v-btn within the v-bottom-navigation remains in an active state even when it has not

I am encountering an issue with a button in the bottom navigation bar of my Vuetify application. I have set up several buttons as routes in Nuxtjs, which become active when the corresponding page is visited. However, there is a button in the bottom nav bar ...

Exploring the technique of importing OBJ files into Three.js

As I attempt to upload an OBJ file along with its associated MTL files into a WebGL scene using Three.js, I have encountered a perplexing issue. In my code, I have included global variables to track the loading progress of the OBJ and MTL files. Strangely, ...