现在如何防止div的高度扩大

时间:2014-05-17 08:03:36

标签: javascript jquery html css

昨天被问到question。现在fiddle工作正常 所以问题是图像后的空白空间。我该怎样预防呢? 我的js:

var indentionFix=0;
var topIndentionInfo=-730;
var leftIndentionInfo=100;
var data="3|name1 a a,4|name2 a a,1|name3 a a,2|name4 a a,5|name5 a a,6|name6 a a,8|name7 a a,555|name8 a a";
var tickets=data.split(",");
var ticketsAmount=Math.ceil(tickets.length/4);
var ticketsCount=0;
for(var i=0;i<ticketsAmount;i++){
    $("body").append("<div id='wrapperDiv_"+i+"' class='wrapperDiv'><img src='http://s30.postimg.org/d4fb4w9ox/for_Print.jpg' /></div>");
   topIndentionInfo=-730;
    indentionFix=0;
    for(var j=0;j<4;j++){
                if(ticketsCount<tickets.length){
                var infoDiv=$("#wrapperDiv_"+i).append("<div id='infoDiv_"+ticketsCount+"''></div>");
                $("#wrapperDiv_"+i).css({"min-height":"500pt"})
                $("#infoDiv_"+ticketsCount).css({position:"relative",width:"200px","min-height":"140px",top:topIndentionInfo+"pt",left:leftIndentionInfo+"pt"});
                topIndentionInfo+=90;
                topIndentionInfo-=indentionFix;
                indentionFix+=3;
                var topIndentionNumber=3;
                var leftIndentionNumber=100;
                var topIndentionSurname=5;
                var topIndentionFirstSecondName=5;
                var ticketValues=tickets[ticketsCount].split("|");
                //  Добавление номеров к листу билетов
                var number=$("#infoDiv_"+ticketsCount).append("<div id=number_"+ticketValues[0]+">"+ticketValues[0]+"</div>");
                $("#number_"+ticketValues[0]).css({position: "relative", top: topIndentionNumber+"pt", left: leftIndentionNumber+"pt", "font-size":"16pt"});
                // Добавление ФИО к листу билетов
                var fioSplit=ticketValues[1].split(" ");
                var surname=fioSplit[0].toUpperCase();
                var firstSecondName=fioSplit[1]+" "+fioSplit[2];
                var surnameDiv=$("#infoDiv_"+ticketsCount).append("<div class='fio' id=surname_"+ticketValues[0]+">"+surname+"</div>");
                var firstSecondNameDiv=$("#infoDiv_"+ticketsCount).append("<div class='fio' id=firstSecondName_"+ticketValues[0]+">"+firstSecondName+"</div>");
                $("#surname_"+ticketValues[0]).css({position: "relative", top: topIndentionSurname+"pt", width:"200px", "font-size":"16pt", "min-height":"20pt"});
                $("#firstSecondName_"+ticketValues[0]).css({position: "relative", top: topIndentionFirstSecondName+"pt", width:"200px", "font-size":"16pt"});
                ticketsCount++;
            }
    }
}

0 个答案:

没有答案