Results 1 to 7 of 7

Thread: Chrome and "Select" Boxes

  1. #1
    Join Date
    Mar 2006
    Location
    Macomb, MI, USA
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Chrome and "Select" Boxes

    I have an issue with Chrome and wonder if anyone has a work around example for it. When I execute the drop down menu and it goes over a "select" drop down, the select drop down bleeds through the menu. I have searched on the web and it has to do with select boxes being on a separate layer, or something like that" that the rest of the page.

    It is my understanding that you need a wrapper like iframe to cover up that select drop down.

    Has anyone else encountered this? Chrome is really nice though.

    I like it alot.

    Here is the link. If you put your mouse over "Claim Services"
    https://testsecure.meemic.com/claimauto1CKR.htm

    Thanks, John
    Last edited by jswidorski; 03-17-2006 at 04:03 PM.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    In IE, yes. All you have to do is hide select elements when displaying the menu, and show them again when it's been drawn.
    Code:
    function hideAllSelects() {
      var e=document.getElementsByTagName("select");
      for(var i=0;i<e.length;i++) e[i].style.visibility = "hidden";
    }
    
    function showAllSelects() {
      var e=document.getElementsByTagName("select");
      for(var i=0;i<e.length;i++) e[i].style.visibility = "visible";
    }
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I have for quite some time thought that the only way to drop down over a select in IE was to hide it. Lately though, it has come to my attention that yes, one can construct an iframe 'shim' for the drop down. This can be rather tricky in practice but the principal is easy enough. The advantage is that it looks much more professional than hiding the select, especially when a drop down would otherwise only partially cover the select. Now this will only work in IE5.5 pc/win plus and may no longer be needed and in fact could be a problem in IE7. That and the fact that it looks bad in FF and will obscure the drop down in Opera is what makes it so tricky. The principal is to make an iframe that can be displayed under the drop down, make it the same height and width and display it at the same coordinates and have its z-index less than the drop down. That's all there is to it, basically. I modified DD's anylink drop down menu to do this and shielded the iframe from other browsers, including IE7, using an iframe set in two IE conditional comments in the head of the page before any scripts that would use it:

    Code:
    <!--[if lte IE 6]>
    <!--[if gte IE 5.5]>
    <iframe id="dropmenuiframe" src="" style="z-index:99;display:none;position:absolute;"></iframe>
    <![endif]-->
    <![endif]-->
    You will note that the iframe has a z-index of 99 so the drop down(s) will need a z-index of 100 or more. In the javascript code, I created a global variable:

    Code:
    var ie5_5=typeof dropmenuiframe=='undefined'? 0 : 1
    This variable can then be tested before performing any operations connected to the iframe:

    Code:
    if (ie5_5) {
    do iframe stuff here
    }
    I realize this is complicated but the results are worth it.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Not much to do with the thread, but...
    Quote Originally Posted by John
    Code:
    var ie5_5=typeof dropmenuiframe=='undefined'? 0 : 1
    I've noticed quite a few people do this recently, and it puzzles me slightly. Comparison operators return true or false already; there's no need to use the if operator. That code could just as easily be:
    Code:
    var ie5_5=(typeof dropmenuiframe=='undefined')
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by Twey
    Not much to do with the thread, but...I've noticed quite a few people do this recently, and it puzzles me slightly. Comparison operators return true or false already; there's no need to use the if operator. That code could just as easily be:
    Code:
    var ie5_5=(typeof dropmenuiframe=='undefined')
    Er, point taken but, that reverses the value.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Oops.
    Code:
    var ie5_5=(typeof dropmenuiframe!='undefined')
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    While we are at the business of condensing the code:

    Code:
    var ie5_5=typeof dropmenuiframe!='undefined'
    I think you should be able to:

    Code:
    var ie5_5=dropmenuiframe
    But only in IE>=5.5<=6 (where dropmenuiframe exists) will that have a happy result. But, to my way of thinking, in other browsers ie5_5 should become known as undefined and return false when later tested. Sadly, this is not the case.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •