Solved

Fadeout page on click and render new page from link

Posted on 2008-10-25
5
839 Views
Last Modified: 2013-11-11
Hi everyone,

I am currently using the script below to tell the page to fade out on click and then render the new page in its place. This works perfectly in Firefox (as usual) but in all IE versions, it fades out all content as required except for absolutely/relatively positioned DIV's. When clicked, all content fades out nicely except these positioned DIV's, once everything is faded out in the set time frame, the positioned DIV's simply flash out.

I was wondering if anyone had any other methods of achieving this effect or any knowledge as to why this script would not be handling positioned DIV's nicely?

Thanks in advance for any assistance or pointers on this mater.
Richard.

Here is a link to the page using this script: http://www.richardmassey.com.au
Just use one of the menu buttons to see the effect issue in IE (buttons do not point anywhere yet).
<script>

function handleClick(elemId,href){

$(elemId).fade(); 

  setTimeout("nav('"+href+"')",1500);

return false;

}

 

function nav(href){

 location.href=href;

}

</script>

 

<a href="test.html" onclick="return handleClick('main-wrapper',this.href);">

Open in new window

0
Comment
Question by:RichardMass
  • 3
  • 2
5 Comments
 
LVL 44

Expert Comment

by:scrathcyboy
ID: 22806172
"why this script would not be handling positioned DIV's nicely?"

If you float a DIV, it takes the DIV out of the page context, so they act independently of the rest of the page, but you can use clear:both; in CSS to fix this issue.  Perhaps IE is treating relative/absolute positioned DIVs the same way.    Here are some different ways to approach this problem, you will have to try them --

www.positioniseverything.net/easyclearing.html
www.css-zibaldone.com/the-css-switch-project/september-2006/float-test-with-display-inline-block/
archivist.incutio.com/viewlist/css-discuss/5106
0
 
LVL 1

Author Comment

by:RichardMass
ID: 22806244
Hi scrathcyboy.

Gave those a try, unfortunately with no luck. Your right about the "it takes the DIV out of the page context", that was something I had not considered. If I don't have any luck with this problem, I think I will try to change the layout to suit the error (never a good option but we do what we have to).

Thank you for your attempt.
0
 
LVL 44

Accepted Solution

by:
scrathcyboy earned 500 total points
ID: 22806332
"try to change the layout to suit the error"
That's a pretty drastic move, if the page is rendering correctly.  Look at the hasLayout property -
http://www.satzansatz.de/cssd/onhavinglayout.html
0
 
LVL 1

Author Comment

by:RichardMass
ID: 22806567
Still no luck I'm afraid. Implemented several of the hacks that appear at the site you linked to and still no luck. Can I confirm that you are able to see the bug when you view my test site: www.richardmassey.com.au

If you are certain the above link should have provided some benefit, could I ask you to please point out exactly what I should be doing as I simply wasn't able to get anywhere.

I thank you again for your time and quick responses. It is very much appreciated.

Richard.
0
 
LVL 1

Author Comment

by:RichardMass
ID: 22827625
OK... In the event anyone is looking for a solution to the same problem, simply setting the DIV that is to perform the fadein or fadeout with position:relative; did the trick. Now anything that is contained within the fading div will fade in/out as required.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now