简体   繁体   中英

DIV Positioning different in IE and Firefox

This is a pretty simple question, clearly it's an issue either with my CSS or JS, my brain is just too fried from staring at this all day to see it.

If you take a look HERE , what I am trying to accomplish is when someone click on either "Products, Spec Sheets, Banners, etc." it switches to the correct slide (UL element), and the arrow pointing down slides under the correct title. Everything works dandy in Chrome; however, in Firefox - the arrow is far to the right, and in IE it's below the container. Here's the JS:

var TabbedContent = {
    init: function() {  
        $(".category").click(function() {
            var background = $(this).parent().find(".selected");
            $(background).stop().animate({
                left: $(this).position()['left']
            }, {
                duration: 350
            });
            TabbedContent.slideContent($(this));
        });
    },
    slideContent: function(obj) {
        var margin = $(obj).parent().parent().find(".sliderContainer").width();
        margin = margin * ($(obj).prevAll().size() - 1);
        margin = margin * -1;

        $(obj).parent().parent().find(".displayContent").stop().animate({
            marginLeft: margin + "px"
        }, {
            duration: 1
        });
    }
}
$(document).ready(function() {
    TabbedContent.init();
});

I'd paste the CSS but it's a little lengthy, it can be viewed HERE (It's under the comment "Here's the CSS for the tabbed content"). So as you can see from the JS, the arrow is supposed to slide under the correct heading in 350ms, and the associated UL slides into position. Now the movement seems to be fine in IE and Firefox, it's just that the positioning of the pointing arrow is way off. Hopefully someone in the community can spot my flaw. Thank you in advance.

try to change the display to inline-block on

.tabbedContent .tabs {
    display: inline-block;
}

(tested in FF and IE - works fine)

Your float s are not being set/cleared properly. Adding float: left; to .selected and to .tabs fixes it in Firefox (Not able to test IE at the moment)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM