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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:30:52+00:00 2026-06-02T11:30:52+00:00

I’m defining a javascript object via the following function: function Window(vars) { this.div =

  • 0

I’m defining a javascript “object” via the following function:

function Window(vars) {
    this.div = $("<div/>", {
        id: vars.id,
        class: vars.styles + " box text",
        css: {
            top: vars.top,
            left: vars.left
        }
    });
    this.div.appendTo( $("body") );
    // more stuff happens..

As you can see, the Window has a div property, which is a jQuery object. In it’s instantiation, I declare the CSS classes box and text. text is not important, it’s just font stuff. Here’s the CSS for box, however.

.box {
 z-index: 1;
 position: absolute;
 background: #222222;
 min-width: 10%;
 text-align: center;
 padding: 5px;
}
.nav-extension {
 z-index: 3;
 padding: 8px;
 background: #000000;
 position: absolute;
 -moz-border-radius-bottomright: 5px;
 -moz-border-radius-topright: 5px;
 border-bottom-right-radius: 5px;
 border-top-right-radius: 5px;
}

box is absolute at z-index 1, and another div with nav-extension is somewhere else on the page, also absolute and at z-index 3. However, when I add the Window object to my page, it appears above anything with nav-extension. All other CSS attribues, like background, still work.

I’ve tried altering the z-index where I instantiate the div in the “css” section I’m already using, but that didn’t work either. What gives?

Edit

Also, I’ve inspected both the div with box and the one with nav-extension with Firefox, and the “Style” tab indicates they still have their intended z-index (not overridden).

#2: Changed vars.class to vars.styles.

  • 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-02T11:30:54+00:00Added an answer on June 2, 2026 at 11:30 am

    Could you give us some DOM, please? It appears that that your box and the nav-extension-div are in different contexts. A non-static position sets up a new context, relatively to which all z-indexes inside are processed. A simple fiddle to demonstrate: http://jsfiddle.net/3KTyz/

    <body>
        <style>
            .box { z-index:1; }
            .nav-extension { z-index:3; }
        </style>
        ...
            <div id="context" style="position:relative"><!-- or absolute or fixed -->
                 ...
                     <div class="nav-extension"><!--
                     will be positioned +3 relatively to other elements in #context
                     -->...</div>
            </div>
        <div class="box"><!--
        will be above #context, which has (implicit) z-index:0
        -->...</div>
    </body>
    

    To make nav-extension appear above the box, you will either

    • set #context (or one of its parents) to a z-index higher than the one of box or
    • move the nav-extension-div outside any context
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.