tags:

views:

73

answers:

2

I've created 2 columns. The 2nd is 240px wide and the 1st takes all available width.

The below displays fine in IE8 & FF3.6:

/*My Styles*/
div.table { display:table; border-collapse: collapse; table-layout:fixed; width:100%; border-spacing:0; padding:0; margin:0;}
div.cell  { display:table-cell; overflow:hidden;vertical-align:top;}


<div class="table">    
        <div class="cell" style="width:100%">
            <div id="tblWFWrap" class="tblWrap">
                <div id="tblWF" style="overflow:hidden">
                    <!--Content-->
                </div>
            </div>
        </div>

        <div id="wfCol" class="cell" style="width:240px;">
            <div id="ulWF" class="tblWrap" style="width:240px">
                <!--Content-->
            </div>
        </div>        
</div>

The problem is that I wish to animate the width of the 2nd cell from 240px to 0. Both browsers fail to display the 2nd column during the animation. (It runs off the screen as if the table layout was auto instead of fixed)

I've been using jQuery 1.4 to do the animation though I'm open to a custom written Javascript implementation if this is a bug in jQuery.

My jQuery code is basically:

$("#wfCol").animate({ width: 0 });

I'd greatly appreciate any help animating this thing :)

A: 

Just remove the 100% width delcaration, the <div> will expand to the width by default and not give the behavior you're talking about:

div.table { display:table; border-collapse: collapse; table-layout:fixed; border-spacing:0; padding:0; margin:0;}
Nick Craver
Thank you for the reply. The problem is that when I do that the 2nd column will run off the page. I believe this is because div.table is no longer bound to the 100% width of the page or it somehow disables fixed layout when no width is specified. If it makes a difference the content of the 1st column is a div w/ overflow:auto and can contain a lot of wide content.
What's really wierd to me is that I can specify a smaller width for column 2 and it will render perfect. It's only during the animation that it messes up.
@user169867 - If you just remove the `width: 100%;` it will solve your problem, I tested here...it's quicker to test and hit Ctrl+Z if it doesn't work than to dismiss something and spend hours trying to figure out a solution already given to you.
Nick Craver
You tested jQuery animations here?? I don't understand. Your solution didn't fix the animation problem for me.
+1  A: 

I believe I've got a work around. For some reason animating maxWidth instead of width works.

So:

<div id="wfCol" class="cell" style="width:240px; max-width:240px">
        <div id="ulWF" class="tblWrap" style="width:240px">
            <%=DashboardController.GetWorkflowString()%>
        </div>
    </div>

and

$wfCol.animate({ maxWidth: 0 });

Works... Wierd but I'll take it :)