我正在用 symfony/twig 做一个生成器,但总是有空页面。(有时 1 ,有时更多)这是我关于页面的 JS:var marginTop = 15;
var cellHeightArray = [];
var rowCounter = 0;
var cellCounter = 0;
var cellHeightArray2 = [];
var rowCounter2 = 0;
var cellCounter2 = 0;
$('.page-three > .spec-box').each(function() {
if(!cellHeightArray[rowCounter]) {
cellHeightArray[rowCounter] = [];
}
var height = $(this).height();
var topHeight = 0;
for(var j = 0; j < cellHeightArray.length; j++) {
if(cellHeightArray[j][cellCounter]) {
topHeight += cellHeightArray[j][cellCounter] + marginTop;
}
}
cellHeightArray[rowCounter][cellCounter] = height;
$(this).css({
"float": "left",
"position": "absolute",
"width": "400px",
"top": topHeight,
"left": (cellCounter * (400 + 50)) + 50
});
if (topHeight + height > 750) {
$(this).appendTo(".page-four");
$("page-four").append("Some appended text.");
}
if(cellCounter == 2) {
rowCounter++;
cellCounter = 0;
}else {
cellCounter++;
}
});
注意::它的横向页面。在我的控制器中,所有边距 => 0 并启用了 javascript。我应该怎么办?我用谷歌搜索了它,有人在谈论它的错误,但确实是。我认为我做错了什么。
这是我的第一页和第二页的CSS
.page-one, .page-two {
font-family: Roboto, 'Segoe UI', Tahoma, sans-serif;
position: relative;
height:992px;
}
第三页 CSS
.page-three, .page-four{
font-family: Roboto, 'Segoe UI', Tahoma, sans-serif;
position:relative;
height:992px;
}