Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6660563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:10:15+00:00 2026-05-26T02:10:15+00:00

If I have a css style that is the following: .transition { transition: left

  • 0

If I have a css style that is the following:

.transition {
    transition: left linear .4s;
    -moz-transition: left linear .4s;
    -o-transition: left linear .4s;
    -webkit-transition: left linear .4s;
}

and the following html:

<div id="mydiv">Test</div>

and the following jQuery:

$(function () {
    $('#mydiv').css('left', '50px');
    $('#mydiv').addClass('transition');
});

then there is still a transition from 0px to 50px when the page loads, despite the fact that the transition class is not added to mydiv until after the css left property is set in jQuery.

I would like to be able to set the initial css left property of mydiv when the page loads (it is calculated based on various parameters) and not be animated, yet still have the transition property set for after the initial page load (moving mydiv after the page loads should be animated).

How can I accomplish this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:10:16+00:00Added an answer on May 26, 2026 at 2:10 am

    You could apply the position on dom ready, and the transition on page load. Try out this fiddle.

    $(function () {
        $('#mydiv').css('left', '50px');
    });
    
    $(window).load(function(){
        $('#mydiv').css('left', '100px');
        $('#mydiv').addClass('transition');
    });
    

    You need to have a separation between applying the two styles. You could accomplish the same effect with a setTimeout.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have div with the following css style: width:335px; float:left; overflow:hidden; padding-left:5px; When I
I have this CSS style that does a rounded corners for div border, but
I have some CSS style that does not work in IE and that works
I have an XML document that I'm trying to style via CSS. A relevant
I have the following CSS .ul{ list-style-image:url(/images/bullet.png) } My bullet.png is 20 x 20px
I have the following HTML code with CSS: <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0
Given the following CSS3 animation.... <style type=text/css media=screen> .drop_box { -webkit-animation-name: drop; -webkit-animation-duration: 2s;
Consider the following HTML markup. In most browsers that I have tested, the second
I have a page called test.aspx and in that page, I have the following
I'm using some CSS transitions like the following: .slide_left { -webkit-transition: all 0.25s ease-in;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.