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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:38:37+00:00 2026-05-13T21:38:37+00:00

This is related to my previous question here . I want 4 divs (absolute

  • 0

This is related to my previous question here.

I want 4 divs (absolute with z-indexes) to start off as being invisible (faded out), and when a link is clicked, the related div fades in. When the same link is clicked, the related div fades out. When a different link is clicked, the first div fades out and the second div fades in.

There is a “covering” div (“#contents_screen”) over these 4 absolute divs. This will probably form my “home” page, so it is required despite seemingly having no purpose.

I got it working to a certain extent, but no cigar. I’d appreciate some help. Thank you very much for looking!

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<style>
#contents {
    width:500px;
    margin:auto;
    height:400px;
    border:1px solid black;
    position:relative;
}
#contents_screen {
    position:absolute;
    width:500px;
    height:400px;
    background:#fff;
    z-index:50;
}
#contents_folio, #contents_services, #contents_about, #contents_contact {
    position:absolute;
    width:500px;
    background:#fff;
    color:#333;
    z-index:20;
}</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
$(document).ready(function(){   
$("a.rollover").fadeTo(1,0.5);
$(".screen").fadeTo(1,0);                   
function identify_active(){
    var activeID = $(".active").attr("id");
    var active_screen;
        $("#contents_screen").fadeTo(1,1);
        $(active_screen).fadeTo(1,0);    

        if (activeID=="folio") {
            active_screen="contents_folio";} 
            else {      
            if (activeID=="services") {
                active_screen="contents_services";}
                else {
                if (activeID=="about") {
                    active_screen="contents_about";}
                    else  {
                    if (activeID=="contact") {
                        active_screen="contents_contact";
        }}}}
    $(active_screen).fadeTo(1,1);   
    $("#contents_screen").fadeTo(1,0);
    }
$("a.rollover").hover(
    function(){$(this).fadeTo("fast",1);},
    function(){

    if(!$(this).hasClass('active')) {
        $(this).fadeTo("fast",0.5);}
    });
$("a.rollover").click(function(){
   if($('.active').length > 0) {    
            if($(this).hasClass('active'))
            {
                $(this).removeClass("active");
                $(this).fadeTo("fast",0.5);
            } else {
                $(".active").fadeTo("fast",0.5);
                $(".active").removeClass("active");
                $(this).addClass("active");
                $(this).fadeTo("fast",1);
                identify_active();
            }
        } else {
                $(this).addClass("active");
                $(this).fadeTo("fast",1);
                identify_active();
        }
        return false;
    });
});
</script>
</head>

<body>
<div id="stage">

<div id="menu">
<ul id="menu">
<li><a class="rollover" id="folio" href="#">folio</a></li>
<li><a class="rollover" id="services" href="#">services</a></li>
<li><a class="rollover" id="about" href="#">about</a></li>
<li><a class="rollover" id="contact" href="#">contact</a></li>
</ul>
</div>

<div id="contents">
<div id="contents_screen">screen</div>
<div id="contents_folio" class="screen">folio</div>
<div id="contents_services" class="screen">services</div>
<div id="contents_about" class="screen">about</div>
<div id="contents_contact" class="screen">contact</div>
</div><!--contents-->
</div><!--stage-->
</body>
</html>
  • 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-05-13T21:38:37+00:00Added an answer on May 13, 2026 at 9:38 pm

    you should use toggle

    http://api.jquery.com/toggle/

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

Sidebar

Related Questions

This is a related to a previous question I have asked here, see the
This question is related to a previous post of mine Here . Basically, I
This is related to my previous question about selecting visible elements . Now, here's
This is related to my previous question I'm solving UVA's Edit Step Ladders and
This is related to my previous question More than 1 Left joins in MSAccess
This is related to my previous question , but a different one. I have
This is related to my previous question , regarding pulling objects from a dmp
This question is related to a previous question of mine That's my current code
This question is related to my previous question How to generate Cartesian Coordinate (x,y)
This question is related to my previous question . The storyline: I have an

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.