刷新后html页面加载不同?

时间:2015-03-27 12:50:29

标签: javascript html css refresh loading

我正在网站上制作一些东西,而且我正在加载大部分html trough javascript。由于某种原因,第一次加载页面时某些东西不起作用,但在刷新后会起作用。

这是发生的事情:

我第一次加载页面时,会发生这种情况(div太大了):

enter image description here

然后刷新后,这发生了(这就是我想要的):

enter image description here

这是我使用的代码:

this.text= "<div class='time mineBorderInvert' style='float:right;display:inline-block;'>0</div>"
this.el.html(this.text);

var H = this.el.find(".time").height();
this.el.find(".restart").css({width:H,height:H});

变量h在我第一次加载页面时返回32,但在刷新之后返回21。此整个代码也是在window.onload函数中触发的函数。

时间div是你可以在图片右侧看到的东西,而重启div就是带有刷新图标的东西。
所以有人知道为什么在第一次加载页面时这不起作用
但是在刷新之后呢?

0 个答案:

没有答案