Begin jQuery animation promptly without any easing

When utilizing the given Jquery example in Chrome, the easing effect during the mouseenter event causes a brief pause in the animation. Is there a way to trigger the animation to start immediately?

The intended outcome is for the animation to shift move css left: -150 - 0; upon mouseenter, and to transition from the current position to -150 upon mouseleave

move css left:(current position) to -150)

JQuery

$(document).ready(function () {     
    $(".menuitem").on('mouseenter mouseleave', function( e ) {      
        $(".slider").stop().animate({left: e.type=="mouseenter"?0:-155}, 1000);   
    });
 })

HTML

<div class='menuitem'>
    Test Menu Item
    <div class='slider'>Message about Item</div>
</div>    

CSS

.slider {
    color: #FFF;
    position: absolute;
    left: -155px;
    width: 155px;
    top: 0px;
    height: 52px;
    transition: 1s;
    z-index: 10;
    border: 1px solid #bb0000;
    background: #bb0000;
    text-align: center;
}
.menuitem {
    float: left;
    overflow: hidden;
    position: relative;
    width: 155px;
    height: 52px;
    line-height: 52px;
    margin-left: 5px;
    line-height: 52px;
    background: #EEE;
    text-align: center;
}

JSFiddle

Answer №1

You currently have the delay set to 1 second.

To fix the issue, try lowering the milliseconds to 100.

When the document is ready, the following function will be executed:

$(".menuitem").on('mouseenter mouseleave', function( e ) {
    // Locate the Slide element.

    $(".slider").stop().animate({left: e.type=="mouseenter"?0:-155}, 100);   
});

END

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

Use PHP to target the identical span

I am facing an issue on my webpage where I have 3 dropdowns that are connected to a central span element named "info". My goal is to have buttons within this span display different data without refreshing the page. How can I achieve this by targeting the s ...

Is there a way to ensure that a child mimics the behavior of its parent when adjusting the opacity and visibility properties of both elements?

Apologies for the ambiguous title, as I am struggling to accurately convey the issue I am encountering. To clarify the problem, I have created a jsFiddle. In my current layout, all four divs have opacity: 1 and visibility: visible, while divs a and b both ...

SVG: Altering the dy attribute has no impact on the overall height of the bounding rectangle for the parent text

We are striving to align a group of tspan elements both vertically and horizontally. However, the parent container is not taking into consideration dy values. This lack of consideration is leading to alignment issues. If you adjust the dy values in this ...

Having difficulty assigning a value to the RadNumeric Text box during the OnBlur event

One of the requirements I have is that, when a user enters any number in a text box and tabs out, leading zeros should be added to the value in the text box. function AddPaddingToInvestmentNumber(sender, args) { var textBoxVar = "<%=txt1.ClientID ...

Using jQuery to Organize JSON Tables

I'm in a bit of a bind... I'm in need of sorting tables from a list of formulas. I've extracted 3 parameters from JSON files and created formulas, but now I need to sort this list of formulas. JSON files: <body> <script> $ ...

Tips for organizing the outcome of a seamless web scraping operation with Apify and Puppeteer

Extracting data from a table on the designated URL using Apify and Puppeteer is my current goal: https://en.wikipedia.org/wiki/List_of_hedge_funds The desired outcome should be an array of objects. Each element in the array must represent a <tr> ro ...

Transfer the HTML5 FullScreen (MAP) feature onto a separate display

I'm trying to integrate a leaflet map into my AngularJS Application, but I've hit a roadblock. My goal is to move the Fullscreen feature of the Map to a second screen (if one is available), allowing users to interact with the application on the ...

Delivering data via Ajax to MVC 4 Controller

Attempting to use Ajax for a simple pass. Both artID and v variables are correctly populated, but consistently encountering an Ajax error. Controller: Article Method: SaveRating Ajax script: $.ajax({ type: "POST", ...

Enhance a portion of your text with some flair

Is it possible to apply styles to specific parts of text that are within an <input> value or a <span> element? For instance, I have the following data: {text text} an other text... I want to add styles to the text enclosed within {}. Here i ...

Unexpected display issues with CSS shapes in Bootstrap framework

Been experimenting with creating custom shapes in Bootstrap - they display correctly in HTML and CSS, but Bootstrap distorts them. It seems like there are no conflicting classes. Could it be necessary to use '!important' on some of the elements? ...

Show different JSON data based on the existence of another key in Javascript

Having recently started learning JavaScript, I attempted the code below but couldn't quite get it to work. Despite consulting various resources, I still wasn't successful. Desired Output: To check if AUTO damage is present in the data. If so, re ...

Retrieve the nearest identifier text from the tables

I have a table on my webpage with some data: <tbody id="carga"> <tr> <td>1</td> <td id="nombre">esteban</td> <td id="apellido">aguirre</td> <td>N/A</td> <td>N/A</td ...

jQuery does not change the scroll position of elements

I'm looking to implement a feature on my website where certain points act as "magnets" and when the user is near one of these points, the window automatically scrolls to the top. I found a jQuery plugin that does something similar which you can check ...

Present the outcome in the specified location

I need to quickly test my code and display the result in a specific area. There's a button that should trigger something to be displayed when clicked. Right now I'm just using an alert for testing purposes. $(document).ready(function () { ...

Is there a way to adjust the slide length in JQuery's slideUp function using pixels? It seems like

At the bottom of a page, I have a fixed position div element. There is another div below it, but it is hidden outside of the page margins. I am attempting to slide both divs upwards so that the bottom one becomes visible (moving out of the margin). However ...

Oops! Looks like there was an issue with assigning to a reference or variable: Error: Uncaught (in promise)

I seem to be struggling with an issue that I believe may have been addressed before, but after reviewing other solutions, I am unable to pinpoint the error in my code. Any assistance in identifying my mistake would be greatly appreciated. <div class="j ...

Issue with !important keyword taking precedence not resolved

While working on a navigation bar button, I encountered a specificity conflict with the opacity property. I attempted to use the !important override but it doesn't seem to be taking effect. Any insights into why this might be happening? Here is the H ...

In Safari, the scrollbar appears on top of any overlays, popups, and modals

On my webpage, I have a div with the CSS property overflow-y: scroll. The page also features several popup modals and overlays. Strangely, the scrollbar of the div appears on top of these overlays instead of behind them. I attempted to resolve this issue b ...

Utilize a fresh font style and replace the font family components in @mui/material with the new

Looking to bring in a fresh font family stored in a fonts directory and replace the existing mui base font family. import { responsiveFontSizes, createTheme } from '@mui/material'; import NEWFONTFAMILLY from '../fonts/something.otf' c ...

Basic HTML Audio Player Featuring Several Customizable Variables

I have a unique API that manages music playback. Instead of playing audio in the browser, it is done through a Discord bot. Achievement Goal https://i.stack.imgur.com/w3WUJ.png Parameters: current: indicates the current position of the track (e.g. 2:3 ...