Text rotating in Chrome shows slight wobbling during animation

I am encountering an issue with a text element that is rotated -90 degrees and needs to translate left and right upon user interaction. However, I have noticed that the element wobbles while moving, specifically in Chrome. Any tips on how to make the animation smoother?

Link to jsfiddle

$(document).ready(function() {
    $('.toggle').click(function() {
        $(this).toggleClass('in').toggleClass('out');
    });
});
.toggle {
    width: 100px;
    height: 30px;
    background-color: blue;
    color: white;
    text-align: center;
    padding-top: 10px;
    font-size: 25px;
    transform: rotateZ(-90deg);
    position: absolute;

    top: 30px;

    transition: all 1s ease;

}

.toggle.in {
    margin-left: -38px
}
.toggle.out {
    margin-left: 50px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class='toggle in'>
    Click me
</div>

Looking for suggestions on improving the smoothness of this animation.

Answer №1

Include the following code snippet:

.toggle {
    -webkit-backface-visibility: hidden;
}

Say goodbye to any wobbling effects!

Check out this link for a demo: http://jsfiddle.net/g97bo56k/2/

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

Using jQuery to dynamically add or remove table rows based on user inputs

Apologies if this is too elementary. I am attempting to insert rows into a table if the current number of rows is less than what the user requires. Simultaneously, I need to remove any excess rows if the current number exceeds the user's specificati ...

Encountering an I18n::InvalidLocale error message (:en is an invalid locale) during a Ruby on Rails AJAX request

While the page loads normally without showing any locale error, an issue arises when making an AJAX request: I18n::InvalidLocale (:en is not a valid locale): i18n (0.7.0) lib/i18n.rb:284:in `enforce_available_locales!' i18n (0.7.0) lib/i18n.rb:15 ...

Issues with Jquery Ajax in Internet Explorer 9

Previously, I had been successfully using this code to call a page method with jQuery and ASP.NET: $.ajax({ type: "POST", url: url + "/" + method, contentType: "application/json;", data: jData, async: true, success: function (res) ...

Looking for an alternative to setOnLoadCallback()?

Currently, I'm working on an internal website and facing a challenge where I am unable to access Google's API for the setOnLoadCallback() function. I have tried looking for JQuery alternatives that could work with my locally hosted JQuery without ...

Working with CodeIgniter and extracting data using an AJAX request

I've been experimenting with this code for a while now and I haven't been able to get it to work. I am working with CodeIgniter framework and when I click the button $('.galName').click(initUpdate);, it calls the following function: fu ...

Can someone assist me in locating a specific web element using Selenium in Java?

Here is the original HTML code snippet: <input id="ember354" class="ember-view ember-text-field search" placeholder="Ask me anything!" type="text"> This element can be reached through body-div-div-input. Attempts to find the element by tag name f ...

The server mistakenly sent the resource as a Stylesheet even though it was interpreted differently

Dear Fellow Coders, Could anyone lend a hand? I encountered this issue on my website after uploading it to my FTP: "Resource interpreted as Stylesheet but transferred with MIME type text/plain" </head> <body> <div class= "navbar navbar ...

I need to display a VARCHAR variable retrieved from PHP in a visually appealing way with HTML/CSS. What is the best way to automatically format it to prevent it from appearing as one long, uninterrupted sentence?

Is there a way to automatically format the text retrieved from a VARCHAR variable in a MySQL database via PHP so that it displays correctly with line breaks? Currently, when I display it on an HTML page, it appears as one long string. I've considered ...

Bootstrap-4 modal not appearing when activated within a dropdown menu

When I tried to use a dropdown feature in my application, I encountered an issue where one of the dropdown items was supposed to open a modal but it wasn't showing up. However, the modal worked perfectly fine when I accessed it using a normal button i ...

What is the best method for enclosing all text within an HTML document with a different element?

For example: FROM <div> whats up! <div> whats up2! </div> thank you for your help <div></div> </div> TO <div> <span>whats up!</span> <div><span> whats up2! </span&g ...

In a carousel slider, the height and width of divs are not set to specific dimensions

For a code snippet, you can visit this link: here The html: <html lang="en"> <head> <link href="https://fonts.googleapis.com/css?family=Lato:400,400i,700,700i|Merriweather:300,400,700" rel="stylesheet"> <link href="https://ma ...

How can I declare CSS variables in Next.js components' module.css just like in global CSS?

When writing CSS in our global file, we often define variables and styles like this: :root{ --orange:#e67e22; --black:#333; --light-color:#777; --border:.1rem solid rgba(0,0,0,.2); --box-shadow:0 .5rem 1rem rgba(0,0,0,.1); } *{ mar ...

Should the HTML inputs be positioned within the label or placed outside of it?

Check out this site for some on/off switches: <div class="onoffswitch"> <input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch" checked> <label class="onoffswitch-label" for="myonoffswitch"> < ...

Is there a way to ensure that my code patiently waits until every iteration within a loop is executed before moving forward?

In my code, I am using a jQuery each function to iterate through a collection of HTML elements. During each iteration, I make use of the get method. My intention is to keep track of the successful get calls and display a count at the end. var numSuccessfu ...

Empty space encompassing the entire sheet

While developing my website, everything seemed normal until I added a CSS document to my HTML page. Now, when we open the website , there is a white space around the entire page. I attempted to set the body class to container-fluid since I am using Bootst ...

Is there a way to send the values of multiple checkboxes using Ajax and display them in separate div elements?

I have a JSP page with checkboxes. I am trying to retrieve the checkbox values and include them in the data property of an AJAX call. When the AJAX call is made, a div will open displaying the selected checkbox values as follows: fruits: Lichi, Mango H ...

Isotope animation glitches causing malfunction

I've been experimenting with CSS3 transitions on isotope items, but I'm encountering some strange behavior. My goal is to achieve a fading effect on the items, similar to this example: . Thank you in advance! Here's what I have so far: http ...

Javascript echoes are appearing in an alert rather than being processed

My registration system utilizes AJAX to process form data and return a false value. The JavaScript code snippet shown at the top handles this functionality. Upon submitting the form, the data is sent to join.php where it undergoes validation to ensure no d ...

What exactly does the symbol "++" signify in the context of jQuery and JavaScript

Throughout my observations, I have noticed people employing i++, especially within a for-loop. However, the specific purpose of ++ when used with a variable remains unclear to me. My attempts to locate documentation explaining its function have been unsuc ...

Arranging Custom-Chechboxes to the Right Using Bootstrap 4

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> <div class="card attribute filter-panel" data-type="select" data-id="1"> <div class="card-header"> <i class="fa fa-angle-dow ...