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

  • SEARCH
  • Home
  • 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 6076879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:39:29+00:00 2026-05-23T10:39:29+00:00

Considering this proof of concept , would it be possible to animate margin-left (both

  • 0

Considering this proof of concept, would it be possible to animate margin-left (both negative and positive values) through JavaScript?.. And how would you go about doing so?

Note: I know this is WebKit-only. And I’m fine with that, seeing as I am developing for iOS Safari.

Update

Thanks for the answers, but jQuery’s animate function doesn’t support pure CSS animations, which is what I need.

  • 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-23T10:39:29+00:00Added an answer on May 23, 2026 at 10:39 am

    I know that you specifically say “can you do this in JavaScript”, but you shouldn’t need to use JavaScript. I’m fairly certain that the proof of concept you link to only uses jQuery as a way to make the animations fall back to JavaScript so that all browsers play nice with the animation. Since you’re specifically developing for Mobile Safari, you shouldn’t need to use jQuery for this except to use a history plugin to push and pop states to make the browser’s back button work; this is entirely doable via CSS transition properties and the :target pseudo-selector.

    So as an alternative, you should be able to do something like this:

    In HTML:

    <div id="thing-that-will-transition">
        <a href="#thing-that-will-transition>click this to transition the div</a>
    </div>
    

    In CSS:

    #thing-that-will-transition
    {
        (bunch of properties)
        -webkit-transition: margin-left [the rest of your transition values]
    }
    
    #thing-that-will-transition:target
    {
        margin-left: [your properties]
    }
    

    As long as your fragment URL matches up with the name of the element that you want to transition then you should be able to push the fragment in to the URL using JavaScript if you absolutely have to instead of using anchor with a fragment href while still having the transition take place. And if you use a jQuery history plugin or do your own pushing and popping of the history stack then you still get back-button behavior for your app.

    I know you specifically asked for a JavaScript solution to trigger the CSS animation, but I’m just not sure why this is what you need. Sorry if this doesn’t help you at all.

    UPDATE: Here’s a jsFiddle demonstrating the above. It uses this jQuery history plugin to manage the history stack, so that you can still get acceptable back/forward button behavior from the fragment URL’s. The anchor tag uses the plugin’s “push” or “load” method in its onClick with a standard fragment in the href attribute as a fallback for browsers without JS enabled.

    UPDATE 2: Here’s another jsFiddle that uses transforms/translations instead of transitions.

    UPDATE 3 (by roosteronacid):

    And as for getting the animations going through JavaScript, you can do:

    var element = document.getElementById("...");
    
    setTimeout(function ()
    {
        element.style.webkitTransitionDuration = "0.3s";
        element.style.webkitTransitionTimingFunction = "ease-out";
        element.style.webkitTransform = "translate3d(300px, 0, 0)";
    }, 0);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm considering using this jquery utility as a possible solution, but I want to
Considering this expression: 3 + 2 + 2 * 2 = ? Would it
Considering this code, can I be absolutely sure that the finally block always executes,
considering this example: public static void main(final String[] args) { final List<String> myList =
Considering this xml document: DECLARE @X XML (DOCUMENT search.SearchParameters) = '<parameters xmlns=http://www.educations.com/Search/Parameters.xsd xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance> <parameter
Considering this question of SO, where whole C# in-memory compiler is being called. When
I'm not considering this - I'm comfortable with C# and VB, but an expert
I suppose this is a long shot considering how few Wonderware questions I've seen
I have this small code library that I'm considering releasing into Open Source. I
Like many others on this site I am considering a move to ASP.NET MVC

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.