Solved

Fadeout page on click and render new page from link

Posted on 2008-10-25
5
841 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
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…

895 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

15 Experts available now in Live!

Get 1:1 Help Now