Make Progress Icon Appear Ontop of Modal Popup

Last post 05-12-2008 10:39 AM by Kriswd40. 5 replies.

Sort Posts:

  • Make Progress Icon Appear Ontop of Modal Popup

    05-09-2008, 4:59 PM
    • Loading...
    • Kriswd40
    • Joined on 06-05-2007, 9:44 AM
    • Posts 223

    I have a progress icon that is created with the following Javascript:

    // Show progress icon

    function onUpdating()

    {

    updateProgressDiv.style.display =
    'block';updateProgressDiv.style.zIndex = '100';

     

    var x = ((document.body.clientWidth/2) - 32);

    var y = ((document.body.clientHeight/2) - 32);updateProgressDiv.style.position = "absolute";

    updateProgressDiv.style.top = y;

    updateProgressDiv.style.left = x;

    }

    The <DIV> that it uses looks like so:

    <div id="updateProgressDiv" style="display: none; height: 40px; width: 40px; z-index: 30;">

    <img src="images/AjaxLoader.gif" id="loadingImage" width="32" height="32" alt="Loading..." />

    </div>

    This works great on my page for the most part, but when I have a modal popup open, I can't see the progress icon. My guess is that it's showing but is behind the modal popup.

    I added the z-index stuff to try and fix this but to no avail.

    Any suggestions how to fix this???

  • Re: Make Progress Icon Appear Ontop of Modal Popup

    05-09-2008, 11:00 PM
    • Loading...
    • whatispunk
    • Joined on 03-06-2007, 10:21 PM
    • Winnipeg
    • Posts 524

    z-index can be pretty tricky. Check out this link for a concise (but thorough) explanation of stacking-order http://css-discuss.incutio.com/?page=OverlappingAndZIndex


    There are a couple critical things to understand about stacking order.

    - Source order counts
    - When a z-index is specified a local stacking order is established

    So if your modal is inside a div with no z-index and your updateProgressDiv is inside another div with no z-index specified (doesn't have to be a div, any containing element will do) then the element declared later in the page will be on top of the other.

    For example:

    <body>
    <div>
       <div id="updateProgressDiv">
          <img />
       </div>
    </div>
    <div>
       <div id="modal"></div>
    </div>
    </body>

    Since the div containing your modal was declared later it will stack on top of the updateProgressDiv. Okay, I think so anyways. z-index is confusing man.

    See, the docs say that technically there is no local stacking order on the 2 containing divs because their z-index is set to auto by default. But I wouldn't trust that. If you really want to see your stacking order proper then you have to take complete control of it. Best solution would be to have your updateProgressDiv and your modalDiv inside the same container so they are in the same stacking context. Also, I don't know what the z-index gets set to by the AJAX framework.

    Hope some of that helps.

    Definitely read that link though. 

    Don't forget to click "Mark as Answer" if someone answers your question. Feel free to mark more than one answer, if you feel so inclined.
  • Re: Make Progress Icon Appear Ontop of Modal Popup

    05-09-2008, 11:07 PM
    Answer
    • Loading...
    • gbogea
    • Joined on 04-14-2008, 11:17 PM
    • Brazil
    • Posts 251

    If you take a look at the HTML generated by modal popup you'll notice that the z-index it generates is huge. I looked at mine and it was :

    z-index: 100001

    Try setting your z-index to something grater than this.

    Hope it helps. 

    Gabriel Bogéa (http://www.gbogea.com)
    -----------------
    Please 'Mark as Answer' the post(s) that helped you
  • Re: Make Progress Icon Appear Ontop of Modal Popup

    05-12-2008, 9:41 AM
    • Loading...
    • Kriswd40
    • Joined on 06-05-2007, 9:44 AM
    • Posts 223

    Thanks for the link, I learned some interesting stuff about the z-index property I didn't know.

    I took a look at the z-index of my modals and they seem to start at 10,000. So to defeat that, I set my progress indicator at 20,000 and it works.

    By the way gbogea, I took a look at your blog and see you're getting ready for the 70-528.. I passed that one in Janaury and it was a ton easier than 70-536, don't be surprized if you pass it earlier than the two months you're planning for (of course that could also be because I'm more familiar with web developement than many of the things in the .Net framework that I really never use on the job). I found the practice tests that come with those Microsoft books really helpful too. The exam focused a lot on the controls in the .Net 2.0 framework, which i guess makes sense because the certification is for .Net 2.0.

  • Re: Make Progress Icon Appear Ontop of Modal Popup

    05-12-2008, 10:02 AM
    • Loading...
    • gbogea
    • Joined on 04-14-2008, 11:17 PM
    • Brazil
    • Posts 251

    Thanks very much for the tips! I'm finding 70-528 study much lighter than 70-536. Also, helping in the forums make me learn a lot so I think I'll be much more prepared.

     

    Gabriel Bogéa (http://www.gbogea.com)
    -----------------
    Please 'Mark as Answer' the post(s) that helped you
  • Re: Make Progress Icon Appear Ontop of Modal Popup

    05-12-2008, 10:39 AM
    • Loading...
    • Kriswd40
    • Joined on 06-05-2007, 9:44 AM
    • Posts 223

    I should clarify, not just .Net 2.0 controls, the exam focus a lot on stuff that is new to .Net 2.0. You can probably tell that from the book though.

    Good luck with the exam!

Page 1 of 1 (6 items)