And*_*rew 3 javascript css jquery height
我试图使用jQuery获取元素的高度,但是我收到了一些意想不到的结果.这是代码:
$(function() {
var contentheight = $('#subpage-content-small').height;
alert(contentheight);
});
Run Code Online (Sandbox Code Playgroud)
#subpage-content-small具有以下CSS属性:
#subpage-content-small { width: 400px; float: left; margin: 30px 10px 0 0; padding-bottom: 45px; }
Run Code Online (Sandbox Code Playgroud)
我作为警报的输出得到的是以下内容:
function (f) { var e = this[0]; if (!e) { return f == null ? null : this; } if (c.isFunction(f)) { return this.each(function (j) {var i = c(this);i[d](f.call(this, j, i[d]()));}); } return "scrollTo" in e && e.document ? e.document.compatMode === "CSS1Compat" && e.document.documentElement["client" + b] || e.document.body["client" + b] : e.nodeType === 9 ? Math.max(e.documentElement["client" + b], e.body["scroll" + b], e.documentElement["scroll" + b], e.body["offset" + b], e.documentElement["offset" + b]) : f === w ? c.css(e, d) : this.css(d, typeof f === "string" ? f : f + "px"); }
Run Code Online (Sandbox Code Playgroud)
知道为什么我得到这个而不是高度的整数?提前致谢!
var contentheight = $('#subpage-content-small').height();
Run Code Online (Sandbox Code Playgroud)
这是一种功能,而不是财产.
归档时间: |
|
查看次数: |
2768 次 |
最近记录: |