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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T23:39:43+00:00 2026-06-18T23:39:43+00:00

Im trying to do the following: – a Link is clicked triggering a function

  • 0

Im trying to do the following:
– a Link is clicked triggering a function that will .show a DIV (#page-cover) dimming down my entire background. This div has a z-index of 999
– Then I want another div (#red) to appear upon the dimmed background / fadeup/show with a higher z-index

My CSS:

#page-cover {
    display: none;
    position: fixed;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 999;
    top: 0;
    left: 0;
}
    #red {
    background-color: red;
    width: 100px;
    height: 100px;
}

HTML

//Triggering link
<a href="#" onclick="dimBackground("Element1")">Element 1</a>
//Div to appear upon dimmed DIV
<div id="red">hejsa</div>
//Dimming DIV
<div id="page-cover"></div>

Jquery

function dimBackground() {
    $("#page-cover").css("opacity",0.6).fadeIn(300, function () {
        //Attempting to set/make #red appear upon the dimmed DIV
        $('#red').css('zIndex', 10000);
    });
}

page-cover fades up as supposed, however i’ve not had any success making #red appear afterwards.

Any suggestions?

  • 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-18T23:39:44+00:00Added an answer on June 18, 2026 at 11:39 pm

    CSS

    #page-cover {
        display: none;
        position: fixed;
        width: 100%;
        height: 100%;
        background-color: #000;
        z-index: 999;
        top: 0;
        left: 0;
    }
        #red {
        background-color: red;
        width: 100px;
        height: 100px;
    }
    

    HTML:

    //Triggering link
    <a id="triggeringlink" href="#">Element 1</a>
    //Div to appear upon dimmed DIV
    <div id="red">hejsa</div>
    //Dimming DIV
    <div id="page-cover"></div>
    

    JS

    $(window).load(function(e){
      $('#triggeringlink').on('click',function(e){
         $("#page-cover").css("opacity",0.6).fadeIn(300, function () {            
            $('#red').css({'position':'absolute','z-index':9999});
         });
       e.preventDefault();
       });
    });
    

    This is a slightly different approach, but I think it’s what you’re after. Instead of inline JS, we’re binding a click event to the <a> tag when the page loads. I’ve updated the CSS so that the RED div is hidden, and positioned absolutely – above the overlay. You may need to pull screen dimensions and position it centered right before fading it in, let me know if this is your intent and I’ll update the answer.

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

Sidebar

Related Questions

I am trying following query to show all of my user at user page...
I'm trying the following: $(#button_feedback).click(function () { $.ajax({ type: POST, contentType: application/json; charset=utf-8, url:
I am using Simple.Data and have been trying to find an example that will
Iam trying the following, the php file, //-----------------------------------------------------------------------------getData.php----------------------------------------------------------- <?php echo '<link rel=stylesheet href=media/styles.css> <script
I am trying the following: boost::shared_ptr< tcp::socket > socket(new tcp::socket( *io_service)); boost::bind(&function, *socket); //
I am trying the following code: <?php $link = mysql_connect('localhost', 'root', 'geheim'); if (!$link)
I am trying following, 1. Get response using Ajax from the users selection which
I currently am trying the following code: $sql = $db->query(select id,username,fullname from userss ORDER
I am trying the following query and get only zero results (I am supposed
I am trying the following piece of code in java, but it doesn't seem

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.