Sean McCullough Learn, Understand, Apply, Share and repeat

4Mar/093

Scroll bars in IE vs. FireFox

I came across a little issue with a project I've been working on for the past week and a bit now. It's an ASP.Net web app that launches in a separate window(1024x768). The second step(the guts) of the app, required that it not scroll. I said "easy, no problem!", opened up the main CSS and added;

body.step2 { overflow: hidden; }

.... done, right?!

Well in FireFox yes, but IE didn't want to take it. I played with it a bit and found that FireFox applies scroll bars to just the <body> tag of your html where as IE applies them to the <html> tag.

A Solution:
I used a bit for jQuery(already in use in this app) to fix this, ONLY in step 2.

$(document).ready(function() {
    $("body.step2").parent().css("overflow", "hidden");
};

This bit of script finds the parent element of the body which is the <html> tag.
I could have done some in-line CSS on step2 but I try and stay away from in-line styles. This solution though seemed appropriate and simple enough.
Cheers,
Sean M

Bookmark and Share
Comments (3) Trackbacks (0)
  1. does not work with Colombian IE3 or Firechiken. please explain promptly. also, ¿how would I build app that in which you upload a pic of yourself (or best friend) and have it use facial recognizacion tech to search the interet for possible fathred children? please post code and solution and any assets I would need most promptly.

  2. Ok, I just realized that I could have just done.
    html body.step2, body.step2 { overflow: hidden; }
    instead of using MORE jQuery than needed.

    *smacks forehead*

    Your friendly neighbourhood,
    Sean McCullough

  3. Wonderful article. I been looking for one on a similar note. I guess you always have something up your sleeve.


Leave a comment


No trackbacks yet.