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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:27:40+00:00 2026-06-15T17:27:40+00:00

Hi there not very proficient in coding. I have #content fading out and in

  • 0

Hi there not very proficient in coding. I have #content fading out and in when .background-button clicked. How do I get text on button to display hide content / show content?

Also I need to fade out another two divs (.button-next, .button-prev) when hide content clicked?

Anyone that can help?

    <!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>


<script type="text/javascript">

var openingdelay = 200; // Delay before fade in initiated (default is 200)
var closingdelay = 100; // Delay before fade out initiated (default is 100)
var openingspeed = 25; // Speed of fade in (default is 25)
var closingspeed = 15; // Speed of fade out (default is 15)

function Show(elementid) {
    ele = document.getElementById(elementid);
        if(ele.style.display == 'none') {
            ele.style.opacity = 0;
            ele.style.filter = 'alpha(opacity=0)';
            ele.style.display = '';
            valueop = 1;
            setTimeout("fadeIn()", openingdelay);
        } 
        else {
            valueop = 9;
            setTimeout("fadeOut()", closingdelay);
        }
}
        function fadeOut() {
        if(valueop < 1) {
        ele.style.display = 'none';
        return false;
        }
            ele.style.opacity = valueop/10;
            ele.style.filter = 'alpha(opacity='+(valueop*10)+')';
            valueop = valueop - 1;
            setTimeout("fadeOut()", closingspeed);
        }
        function fadeIn() {
        if(valueop > 10) {
        return false;
        }
            ele.style.opacity = valueop/10;
            ele.style.filter = 'alpha(opacity='+(valueop*10)+')';
            valueop = valueop + 1;
            setTimeout("fadeIn()", openingspeed);
        } 


</script>
<style type="text/css">
.layer1 {
margin: 0;
padding: 0;
width: 500px;
}

.background-button {
margin: 1px;
color: #fff;
padding: 3px 10px;
cursor: pointer;
position: relative;
background-color:#c30;
float:right;
}
#content {
padding: 5px 10px;
background-color:#000;
float:left; width:400px; height:600px; color:#FFF
}

</style>
</head>

<body>

<div id="content" >Hello! This will remain hidden until the link is clicked.</div>

<div class="background-button"><a href="#" onClick="Show('content'); return false;">Click Me To Reveal More</a></div>

<div style="background-color:#000; color:#FFF; position:absolute; right:0px; top:100px; height:50px; width:100px;" id="button-next">next</div>
<div style="background-color:#000; color:#FFF; position:absolute; right:0px; top:200px; height:50px; width:100px;" id="button-prev">prev</div>


</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-06-15T17:27:41+00:00Added an answer on June 15, 2026 at 5:27 pm

    I modified your html to put and ID to the link: #show_more

    HTML:

    <div id="content" >Hello! This will remain hidden until the link is clicked.</div>
    
    <div class="background-button"><a id="show_more" href="#">Click Me To Reveal More</a></div>
    
    <div style="background-color:#000; color:#FFF; position:absolute; right:0px; top:100px; height:50px; width:100px;" id="button-next">next</div>
    <div style="background-color:#000; color:#FFF; position:absolute; right:0px; top:200px; height:50px; width:100px;" id="button-prev">prev</div>​
    

    jQuery:

    $('#content, #button-next, #button-prev').hide();
    $('#show_more').click(function(e) {
        e.preventDefault(); // disable default <a> behavior
    
        if ($('#content').is(':visible')) {
            $('#show_more').text('Show Content');
        } else {
            $('#show_more').text('Hide Content');
        }
    
        $('#content, #button-next, #button-prev').fadeToggle();
    });
    

    The first line simply hides the content and buttons. You should hide them via CSS or inline styles and remove this line of code.

    edit: jsFiddle

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

Sidebar

Related Questions

I'm not very good at regex but maybe there's a simple way to achieve
there's this interesting problem i can not solve myself. I will be very glad,
ActiveRecord's query interface seems for me sometimes very complex and not intuitive. Is there
I am not very good in regex but there is an illogic thing that
This may be a basic question but I'm not very proficient in SQL Server.
Im not proficient in JS myself very much, so it would probably take me
I saw this question , but the answers there are not very relevant. A
There are not very many options for a virtualizing wrap panel for use in
First, I am not very good in regex so there may be a mistake
QUESTION: Re use of .NET Backgroundworker, is there not a way to let exceptions

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.