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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:26:16+00:00 2026-06-07T16:26:16+00:00

What I want: When the page loads, the element should be invisible, no matter

  • 0

What I want:

When the page loads, the element should be invisible, no matter how big the size of the viewport is. After a certain amount of time, I want the element to fly in.

What I have so far:
This code (http://jsfiddle.net/LdfZw/1/):

HTML

<div id="div1">
    <p>Lorem ipsum</p>
</div>​

CSS

#div1 {
    margin-left: 10%;
}

jQuery

var  tenPercent = $( window ).width()*0.1;

$('#div1').css('margin-left',-tenPercent);

setTimeout(function() {
    $ ('#div1').animate({marginLeft : tenPercent},1000 );
    }, 1000 );​

The problem:

Actually, there is more than one problem with this code.

  • It’s not working with small window sizes (see fiddle), why?
  • When the window is resized after the element flew in, the margin-left is of course not 10% of the new window size. Is there a solution for it? Applying .css("margin-left","10%"); seems a bit redundant. Maybe something with resize();?

I would really appreciate any form of help!

​

  • 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-06-07T16:26:17+00:00Added an answer on June 7, 2026 at 4:26 pm

    why not positioning the element absolutely:

    #div1 {
        left: -20%;
        position: absolute
    }
    
    setTimeout(function() {
        $('#div1').animate({left : 0},1000 );
    }, 1000 );
    

    DEMO

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

Sidebar

Related Questions

When my Silverlight page loads, I want to set focus on a control. Simple
I have a stripes action page. and When the page loads, I want to
I am trying url persistence for the first time, and after a page load,
I have a page that loads different forms depending on user choice. I want
I have a page that loads with content. I .clone() certain elements, then hide
I want on page load for the class of a li tag to be
I want to fake a simple animation on page load by sequentially revealing several
I want to get exception of page load, but still have not results on
Hi I want to set opacity for a form in page load. I try
I want to display images on a .net page which I load from database

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.