/    Sign up×
Community /Pin to ProfileBookmark

help with div jumping issues?

So, I have a set of divs in a sentece, and within one div is a link. When the link is clicked, I have all the other divs fade out, and the link is supposed to move to the left, then up. I can accomplish this easily, however, I’ve noticed that there’s a pause between when all the divs fade out, and then the moving of the link. During that pause, it jumps to the leftmost edge of the div that it is contained in.

Is there a way to prevent the div from jumping? The following is the code that I have. (I’ve supplied the html and javascript)

I tried using callbacks to prevent the div from jumping, but that didn’t really work…

[CODE]<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html>
<head>
<script type=”text/javascript” src=”https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js”></script>
<script type=”text/javascript”>
$(function(){
$(‘#container #main #about’).click(function(){
$(‘#container #main #design’).fadeOut(4000);
$(‘#container #main #headline’).fadeOut(4000, ‘swing’, function(){
$(‘#container #main #about’).animate({
“top” : “-250px”
});
});
});
});
</script>
<title>tai says: “coming soon!”</title>
</head>
<body>
<div id=”container”>
<div id=”main”>
<div id=”headline”>My name is&nbsp;</div><div id=”about”><a href=”#”>Tai</a></div><div id=”headline”>. I&nbsp;</div><div id=”design”><a href=”#”>design</a></div><div id=”headline”> pretty things for people to look at.</div>
</div>
</div>
</body>
</html>[/CODE]

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@afrobullauthorDec 25.2010 — This is the effect I would like to mimic. When you click on one of the buttons in this site, the remaining buttons fade out and the button moves to the top of the page.

Does anyone know of a plugin or can help tell me how to do it within my code?
×

Success!

Help @afrobull spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...