Fixed jQuery min / max width limitation for IE6

Does anyone know of a decent, reliable, jQuery based min / max width for IE6

+2


source to share


4 answers


I saw one of the creators of yaml http://builder.yaml.de/



+1


source


This one looks decent. I haven't tried it, but it looks at browser resizing. Still needs to adapt, I highly doubt it is ripe ready (there are hardcoded things in there).



+1


source


Should there be a jQuery fix? If only the CSS you are trying to compensate for, you can use CSS Expressions to solve your IE6 width and width issues like this:

#wrap {
    width: expression(document.body.clientWidth < 742? "740px" : document.body.clientWidth > 1202? "1200px" : "auto");
}

      

You can take the same code into your JavaScript if you are really looking for a JS fix. I'm just trying to keep CSS for presentation, JS for further enhancement.

There are performance issues associated with using CSS expressions, however if you are using IE6 then you have big problems ...

+1


source


I know this is an old thread, but I landed here from a google search since I had the same problem. I tried using an expression for IE, but my problem is that I have to calculate the maximum image size dynamically as the page resizes. I have no control over the size of the images on the server, so I have to go down this road.

At the end, I added a function that I call when the page has finished loading (using $ (document) .ready (), since this does not wait for the images to load, just the DOM). Then I call the same function when the page changes. Then the code I used to set the maximum width on images:

    // Calculate the max width that the images can be
    var maxWidth = $('#some-container').width();

    // Make sure the div that contains the image is set to this maxWidth
    $('#someDiv').width(maxWidth);

    // Set the max width using CSS for nice standards compliant browsers
    $('#someDiv img').css('max-width', maxWidth);

    // For non-compliant browsers like IE, iterate over all the images and manually set their size (should probably only do this for IE, but doesn't hurt)
    $('#someDiv img').each(function(index) {
        if ($(this).width() > maxWidth){
            $(this).width(maxWidth);
        }
    });

      

+1


source







All Articles