English 中文(简体)
j Query .hels () don t work as expected
原标题:jQuery .height() doesn t work as expected

我有一页,希望彼此相邻的四分五裂的高度相等。

我有以下职能:

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.

感谢你们的帮助!

最佳回答

公正解决! 我的想法是将“人{显示:无”放在 c中,并将这一财产重新置于文件结尾处。 我之所以这样做,是因为我使用了j Query UI纽芬兰语,而用户则看到这些纽芬兰语从正常的链接转到了国际不动产局的布局。

当我取消这一功能时,一切都再次奏效。 似乎在称为“项目”时,尸体仍然显示:24小时。 因此,没有计算出的高度。

感谢你们的帮助!

问题回答

要求从窗户(有效)活动而不是文件(现成)起这一功能。

之所以出现这一问题,是因为j Query没有启动湿度和高度环境,直到所有成像/目标/要素都完成了装货——一页处理即可燃起,但有些物体可能仍在下载。

2. 确保你有一个内容,明确浮标/适用明确的固定办法(如果有的话)。 如果你不这样做,至少母集装箱不会扩大到应有的高度。

还试图使用<代码>.outerHala(<>>>>>>,因为这包括边界大小和dding。

你的选择可能是错误的。 你们应该自己利用id,因为女ids在文件中是独一无二的,而且最快的眼光是:

$( # +i)

also as people have mentioned, its not valid to have an id start with a number (but works in most browsers)

同样,你可能在OMOM中拥有重复女胎,在这种情况下,你不会像你所期望的那样工作。女婴必须是独特的

您是否确保每一条<代码>,项目要素也有适当的识别特征,因为<代码>$(“div.project#”+i) 选择人希望获得0、1、2等的识别资料?

If tag ids are 1, 2, 3 then please give space after project

$("div.project #"+i)




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签