我有一组产品清单,每个产品清单下面都有一个链接,上面有一个点击事件,当点击它进入父类时,找到下面的"surf_prod1"类并滑动它.其中一个函数用一个"surf_prod"类检查所有div并得到最大的innerHeight,它被传递回来并用作所有具有"surf_prod"类的div的高度.
这对于第一次点击起作用的鳍,但后续的鳍没有效果,只有初始高度似乎有效,不确定这是否是由于某种形式的缓存?
希望有人可以提供帮助.
这是我的HTML:
7'2" - Egg
FINSN : 16 1/4
M : 21 1/4
T : 14 3/4
Th : 2 3/8
Centre : US 8" TAK 4.5
Side : FCS M5
Board ReviewIf you're not quite ready to "rip and shred" on a short board, nor are you apt to "cruise" on a long board, then the Hawaiian Pro Designs Egg is the perfect solution. This model is an "eggy" looking shape that allows the rider to trim high on the wave in the middle of the board or race down the line on the tail, whichever the rider prefers. This board is also a perfect beginners board because of the overall forgiving shape that allows for a variety of mistakes without loss of speed or manoeuvrability.
More
和我的JavaScript:
function equalHeight(group) { var tallest = 0; group.each(function() { thisHeight = $(this).innerHeight(true); if(thisHeight > tallest) { tallest = thisHeight; } }); return tallest; } $(document).ready(function(){ $(".review_body").slideUp("fast"); $(".review_link").click(function(ev){ ev.preventDefault(); var link = $(this).attr('href'); //Get the review container to be able to manipulate the children of it $(this).parent(".review_box").find(".surf_prod1").slideToggle("fast", function(){ var surf_prod_height = equalHeight($("div.surf_prod")); $("div.surf_prod").height(surf_prod_height); document.location = link; }); }); });
这里的例子.
一旦你设置了高度,它就不再取决于内容,所以第二次,你得到所有div的相同高度 - 你第一次设置的高度.
在找到所需高度之前,请尝试将高度设置为"自动":
$("div.surf_prod").height("auto"); var surf_prod_height = equalHeight($("div.surf_prod")); $("div.surf_prod").height(surf_prod_height);