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 6954709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:38:27+00:00 2026-05-27T14:38:27+00:00

This is not a jquery problem But a general algorithm problem. i have mentioned

  • 0

This is not a jquery problem But a general algorithm problem.

i have mentioned that my animation needs to work for 5 sec. On 1024 to 1600 monitor it woks fine. But on smaller monitor it’s too fast. How do i slowdown based on screen width. i.e animation needs to calculated based on screen width,

say i mention for 1024 width it needs to work for 7 sec. Even if the screen decreases it should work for 7 sec.

Again on larger monitor since width is more again and time is less (7 sec) the animation is again fast so here again the time has to be increased.

Final effect from ratio of both needs to be same

Here is my code in case any one has a jquery solution

$("#plane").css({
    'margin-left'   : $(window).width() - 300,
    'position'  : 'absolute'
}).animate({
    "margin-left" : '35%'
}, 5000, 'linear', function(){
    $(this).animate({
        "opacity"       : 0,
        "margin-left"   : 0
    }, 2200, 'linear')
});
  • 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-27T14:38:27+00:00Added an answer on May 27, 2026 at 2:38 pm

    You can calculate the desired time.

    It sounds like you’re describing an algorithm where if the window is less than 1024 px wide, then you want 7 seconds, but if greater than that, you want it to take longer. So, let’s say we scale the time linearly above 1024px so if it’s 2048px wide then it would take 14 seconds. That can be described with this calculation:

    var animTime = 7000;
    var width = $(window).width();
    if (width > 1024) {
        animTime += Math.floor((width - 1024) / 1024) * 7000);
    }
    

    You could then split that time between your two pieces of the animation:

    $("#plane").css({
        'margin-left'   : $(window).width() - 300,
        'position'  : 'absolute'
    }).animate({
        "margin-left" : '35%'
    }, Math.floor((5/7) * animTime), 'linear', function(){
        $(this).animate({
            "opacity"       : 0,
            "margin-left"   : 0
        }, Math.floor((2/7) * animTime), 'linear')
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why this delay of Jquery animation does not work as it should be? $(
I have a feeling that this probably is not possible using strictly CSS, but,
I have a jQuery problem that I can't seem to work out on my
I am creating one progress bar with jQuery but problem is this that i
I already have a solution for this problem but I do not understand why
this is the problem: I'm using javascript and JQuery (not UI) to drag nested
This is not a question about jQuery, but about how jQuery implements such a
How do I unbind hover in jQuery? This does not work: $(this).unbind('hover');
This works in jQuery 1.3.2, but not in 1.4 $(#container).children().map(function() { var child =
I made this code with jQuery to fade images ( but not the one

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.