【发布时间】:2014-03-11 22:38:23
【问题描述】:
我正在使用 Zurb Foundation 来制作我的网站。我正在使用定价表来定义所有产品。这些图像将所有定价表扔到不同的高度。这是页面:http://codywd.x10.mx/supracing/products.html
为了解决这个问题,我找到了一个可以工作的 jQuery 脚本,但不是我需要的方式。
这里是 jQuery
<script>
var currentTallest = 0,
currentRowStart = 0,
rowDivs = new Array(),
$el,
topPosition = 0;
$('.pricing-table').each(function() {
$el = $(this);
topPostion = $el.position().top;
if (currentRowStart != topPostion) {
// we just came to a new row. Set all the heights on the completed row
for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) {
rowDivs[currentDiv].height(currentTallest);
}
// set the variables for the new row
rowDivs.length = 0; // empty the array
currentRowStart = topPostion;
currentTallest = $el.height();
rowDivs.push($el);
} else {
// another div on the current row. Add it to the list and check if it's taller
rowDivs.push($el);
currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest);
}
// do the last row
for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) {
rowDivs[currentDiv].height(currentTallest);
}
});
</script>
它在每个定价表的末尾添加了一个白色块(请参见此处:http://i.imgur.com/oJm2jsc.png)我已经使用基础随附的内置均衡器包对此进行了测试,它的作用完全相同。
如何让它在描述 li 中而不是在每个 ul 的末尾添加一个白色块?
如果您也需要,以下是一些示例定价表:
<div class="large-8 columns">
<div class="row">
<div class="large-4 small-6 columns">
<ul class="pricing-table">
<li class="title">SUP Racing T-Shirts</li>
<li class="bullet-item"><img src="img/product-imgs/SUP_Tees.jpg"></li>
<li class="description">Show your SUP Racing Pride!</li>
<li class="price">$18.00 + S&H</li>
</ul>
</div>
<div class="large-4 small-6 columns">
<ul class="pricing-table">
<li class="title">SUP Porting for CR/500</li>
<li class="bullet-item"><img src="img/product-imgs/SUP_Porting.jpg"></li>
<li class="description">Great power and torque throughout the entire power band.</li>
<li class="price">$395.00 + S&H</li>
</ul>
</div>
<div class="large-4 small-6 columns">
<ul class="pricing-table">
<li class="title">SUP Pipe for CR/500</li>
<li class="bullet-item"><img src="img/product-imgs/SUP_Pipe1.jpg"></li>
<li class="description">Our custom-designed pipe will give you better torque, and more useable power at a lower R.P.M.
This price includes ceramic coating, silencer, flange, and front and rear mounts.</li>
<li class="price">$654.00 + S&H</li>
</ul>
</div>
</div>
【问题讨论】:
-
如果您更新到 Foundation 5.2,有一个新的均衡器功能可以做到这一点。官方文档中有一个如何将其与定价表一起使用的示例。
-
均衡器功能会导致同样的问题(在定价表末尾添加了白框,而不是在定价表的描述部分。)这是使用 Foundation 5.2。
标签: javascript jquery html css zurb-foundation