2012-02-15 39 views
0

將此http://jsfiddle.net/AndyMP/tbYsM/1/http://jsfiddle.net/AndyMP/tbYsM/2/配合使用,不支持。float:left breakage

第一個只是一個文本塊。第二,我試圖把它分成彼此相鄰的兩列。我用標籤包圍了文本,包括哪些是打破它的位。

任何想法解決方案是什麼?

jQuery的

var $block1 = $(".block1"); 
var $block2 = $(".block2"); 
var $blog_slide_container = $('#blog_slide_container'); 
$blog_slide_container.animate({height: $block1.outerHeight()}); 

$(function() { 
$(".left_slide").click(function() { 
    $block1.stop(true, true).animate({ left: -400 }, 500, function() { $(this).hide(); }); 
    $blog_slide_container.animate ({height: $block2.outerHeight()}); 
    $block2.stop(true, true).animate({ left: 0 }, 500); 

}); 

$(".right_slide").click(function() { 
    $block1.show(); 
    $blog_slide_container.animate({height: $block1.outerHeight()}); 
    $block2.stop(true, true).animate({ left: 400 }, 500); 
    $block1.stop(true, true).animate({ left: 0 }, 500); 
}); 
}); 

回答

1

只需在兩個浮動div後面添加一個帶clear: left;的div。它在行動中。

2

我想你只需要戴上外層div的float: left;然後clear: both;clear: left;在內之一。查看更新:http://jsfiddle.net/tbYsM/4/