我使用以下JS代码创建高度相等的列:
var colHeight = Math.max($('.3columngallery .col1').height(), $('.3columngallery .col2').height(), $('.3columngallery .col3').height());
$('.3columngallery .gallery').height(colHeight);
在Firefox和Safari中工作正常,但在Chrome和Opera中则不能。
这是页面的链接,我在其中使用了此脚本:http://www.jaspreetkaur.com/gwstudio/product-gallery
最佳答案
如果您在此容器中使用图像,则应使用
$(window).load(function ()
代替
$(function() {
因为图像未加载到dom中。
关于javascript - 等高列,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9837456/