Solved

Fadeout page on click and render new page from link

Posted on 2008-10-25
5
846 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

756 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