我有一页,希望彼此相邻的四分五裂的高度相等。
我有以下职能:
function setProjectsHeight() {
var count = 0;
$(".project").each(function() {
if(count % 3 === 0) {
var highest = 0;
for(i=count;i<=count+2;i++) {
if($("div.project#"+i).height() > highest) {
highest = $("div.project#"+i).height();
}
}
console.log(highest);
}
count++;
});
}
某些高点总是零。 选择人看来是正确的(经测试),如果选择人与同一选择人的休妻,则其回报为200(更正)。
EDIT: Just solved it! Somehow I had the idea to set "body {display:none}" in the css and set this property back to block at the end of document.ready(). I did this because I use jQuery UI buttons and users saw those buttons switch from a normal link to the UI lay-out.
When I removed this functionality, everything worked again. It seems when setProjectsHeight() was called, body was still display:block. Thus, there was no calculated height.
感谢你们的帮助!