Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Twitter bootstrap 引导栏不同高度动态网站_Twitter Bootstrap_Css - Fatal编程技术网

Twitter bootstrap 引导栏不同高度动态网站

Twitter bootstrap 引导栏不同高度动态网站,twitter-bootstrap,css,Twitter Bootstrap,Css,我知道这个问题很常见,但我还是没能解决。我在bootstrap中有一个动态galery填充列,但是每次的高度都不同,所以我得到了这个结果 我知道clearfix解决了这个问题,但是每次较长的列出现在不同的位置 这是我的代码: <div class="container" > <div class="row "> <div class="col-lg-2 col-md-3 col-sm-4 col-xs-6">

我知道这个问题很常见,但我还是没能解决。我在bootstrap中有一个动态galery填充列,但是每次的高度都不同,所以我得到了这个结果

我知道clearfix解决了这个问题,但是每次较长的列出现在不同的位置

这是我的代码:

<div class="container" >
  <div class="row ">


    <div class="col-lg-2 col-md-3 col-sm-4 col-xs-6">          
      <p align="center"><img src="https://lh3.googleusercontent.com/-obJ2fXQMQmg/VawsKPc7b3I/AAAAAAAANSg/DMBlW4LnRos/s208/image.jpg"></p>
      <p align="center">Floral silk chiffon with all over beading </p>
    </div>


    <div class="col-lg-2 col-md-3 col-sm-4 col-xs-6">          
        <p align="center"><img src="https://lh3.googleusercontent.com/-zxR4MthXI00/VawsRkw3kLI/AAAAAAAANTg/A5h-HszkUMs/s208/image.jpg"></p>
        <p align="center">Large chevron raw silk/cotton with elaborate jewel neck piece</p>
    </div>


    <div class="col-lg-2 col-md-3 col-sm-4 col-xs-6">          
        <p align="center"><img src="https://lh3.googleusercontent.com/-kNvVqJ2pt24/UazRmaF_UAI/AAAAAAAABwk/d7tJSITBTYM/s208/image.jpg"></p>
        <p align="center">Black satin lace with elaborate beaded trim and 18" fringe</p>
    </div>

    <div class="col-lg-2 col-md-3 col-sm-4 col-xs-6">          
        <p align="center"><img src="https://lh3.googleusercontent.com/-eZq3QyMgF00/VQ8old75g9I/AAAAAAAAL1w/hifLnq6OE0I/s208/image.jpg"></p>
        <p align="center">Green Modal fabric with elaborate trim </p>
    </div>

    <div class="col-lg-2 col-md-3 col-sm-4 col-xs-6"          
        <p align="center"><img src="https://lh3.googleusercontent.com/-eZq3QyMgF00/VQ8old75g9I/AAAAAAAAL1w/hifLnq6OE0I/s208/image.jpg"></p>
        <p align="center">Green Modal fabric with elaborate trim </p>
    </div>

    <div class="col-lg-2 col-md-3 col-sm-4 col-xs-6">          
        <p align="center"><img src="https://lh3.googleusercontent.com/-eZq3QyMgF00/VQ8old75g9I/AAAAAAAAL1w/hifLnq6OE0I/s208/image.jpg"></p>
        <p align="center">Navy and rose gold silk with elaborate beaded trim</p>
    </div>

    <div class="col-lg-2 col-md-3 col-sm-4 col-xs-6">         
        <p align="center"><img src="https://lh3.googleusercontent.com/-eZq3QyMgF00/VQ8old75g9I/AAAAAAAAL1w/hifLnq6OE0I/s208/image.jpg"></p>
        <p align="center">Yellow, pink and green crepe with greek key ribbon and paisley patches</p>
    </div>

    <div class="col-lg-2 col-md-3 col-sm-4 col-xs-6">          
        <p align="center"><img src="https://lh3.googleusercontent.com/-eZq3QyMgF00/VQ8old75g9I/AAAAAAAAL1w/hifLnq6OE0I/s208/image.jpg"></p>
        <p align="center">Red jacquard lace and lined in chiffon with elaborate beaded trim</p>
    </div>

    <div class="col-lg-2 col-md-3 col-sm-4 col-xs-6">         
        <p align="center"><img src="https://lh3.googleusercontent.com/-eZq3QyMgF00/VQ8old75g9I/AAAAAAAAL1w/hifLnq6OE0I/s208/image.jpg"></p>
        <p align="center">Black Modal fabric with ribbon trim</p>
    </div>

    <div class="col-lg-2 col-md-3 col-sm-4 col-xs-6">          
        <p align="center"><img src="https://lh3.googleusercontent.com/-eZq3QyMgF00/VQ8old75g9I/AAAAAAAAL1w/hifLnq6OE0I/s208/image.jpg"></p>
        <p align="center">Aztec print charmeuse with circle beaded trim</p>
    </div>

  </div>          
  </div> 

印花丝质雪纺绸,饰满珠饰

大型V形生丝/棉质面料,搭配精致的珠宝颈片

黑色缎面花边,精致串珠镶边和18英寸流苏

绿色莫代尔面料,精心剪裁


如果不想使用JavaScript,则必须为包装器指定最小高度。由于其高度可能随文本而变化,因此会出现对齐问题

解决此问题的一种常见且快速的方法是使用JavaScript使用等高

equalheight = function(container) {

    var currentTallest = 0,
        currentRowStart = 0,
        rowDivs = new Array(),
        $el,
        topPosition = 0;
    $(container).each(function() {

        $el = $(this);
        $($el).height('auto')
        topPostion = $el.position().top;

        if (currentRowStart != topPostion) {
            for (currentDiv = 0; currentDiv < rowDivs.length; currentDiv++) {
                rowDivs[currentDiv].height(currentTallest);
            }
            rowDivs.length = 0; // empty the array
            currentRowStart = topPostion;
            currentTallest = $el.height();
            rowDivs.push($el);
        } else {
            rowDivs.push($el);
            currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest);
        }
        for (currentDiv = 0; currentDiv < rowDivs.length; currentDiv++) {
            rowDivs[currentDiv].height(currentTallest);
        }
    });
}
$(window).resize(function() {   //to work in resize
    equalheight('.col-lg-2.col-md-3.col-sm-4.col-xs-6');
});

$(document).ready(function() {
 equalheight('.col-lg-2.col-md-3.col-sm-4.col-xs-6');
});
equalheight=函数(容器){
var=0,
currentRowStart=0,
rowDivs=新数组(),
$el,
顶置=0;
$(容器)。每个(函数(){
$el=$(此项);
$($el).height('auto')
topPostion=$el.position().top;
if(currentRowStart!=topPostion){
对于(currentDiv=0;currentDiv