- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我写了一些例子来看看有什么区别,但它们显示的宽度和高度的结果相同。
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var div = $('.test');
var width = div.width(); // 200 px
var innerWidth = div.innerWidth(); // 200px
var outerWidth = div.outerWidth(); // 200px
var height = div.height(); // 150 px
var innerHeight = div.innerHeight(); // 150 px
var outerHeight = div.outerHeight(); // 150 px
});
</script>
<style type="text/css">
.test
{
width: 200px;
height: 150px;
background: black;
}
</style>
</head>
<body>
<div class="test"></div>
</body>
</html>
在此示例中,您可以看到它们输出相同的结果。如果有人知道有什么区别,请告诉我适当的答案。
谢谢。
最佳答案
关于javascript - jQuery中的宽度,innerWidth和outerWidth,height,innerHeight和outerHeight有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17845027/
我只是想知道 window.outerWidth 和 $(window).outerWidth() 之间的区别,如果有的话。 我真的无法在 Google 上找到太多关于此的信息,所以我想我会吸引大众。
我有以下元素。 var e=$('', {"class":'someClass',text:'Hello'}); 我想得到它的外部宽度。看来我不能只使用 e.outerWidth() 因为它需要先写入
window.outerHeight/window.outerWidth 这个值不是以像素为单位吗? http://www.w3schools.com/jsref/tryit.asp?filename
我正在使用一些 jQuery 在元素的顶部和左侧添加负边距,以便将其居中对齐到 div 中。 $('.centred').each(function(event) {
我创建了一个弹出框类。每个弹出窗口都可以有可变内容,并出现在可变位置,具体取决于光标打开时的位置,因此弹出窗口看起来像是从单击的链接或按钮中弹出的。 问题是如果光标离边框太近,弹出窗口可能部分位于屏幕
我正在尝试对 jQuery UI MultiSelect Widget 进行一些调整. 我遇到的一个问题是在我刷新控件后主控件有点太宽了。查看代码,宽度设置为: var width = this.el
我有一个 jQuery 脚本,它通过普通的 CSS 宽度属性将元素的宽度设置为 50%。 如果我然后输出 outerWidth(true)要获得准确的像素值,它有时与 $(window).width(
在 MooTools 中是否有与 jQuery 的 outerWidth 等效的东西? 我想得到 block 的width + margin-width + padding-width + borde
我正在使用 window.outerWidth 来获取工作正常的窗口宽度。然而,问题是如果您将页面加载到未聚焦的选项卡中,window.outerWidth 将为 0。有什么解决方法吗? Chrome
精简版 如果我不设置水平边距,我的代码运行良好。这就是为什么我的代码使用 .width() 来获取和设置元素宽度,但我不能对 .outerWidth() 做同样的事情,因为它是只读的。有办法设置吗?
我有一个水平滚动的图片库。 包含所有图像的宽度通过汇总所有子图像的 outerWidths 动态生成。 画廊的设置方式如下: Half Bubble - $50.00 Bub
我很困惑。 http://jsfiddle.net/pyn8s/ 点击登录按钮。等待弹出窗口出现。注意它的位置。再次单击登录按钮。看着它向左移动。 (正确位置)再次单击登录按钮。请注意,它不再移动了。
是否可以使用dom获取元素outerWidth? Ej: var width = document.getElementById('myDiv').outerWidth; 最佳答案 没有,但你可以获得
我检查了 Firebug 中的 window 对象。 window.innerWidth 和 window.outerWidth 均为 1230。 这两个值有什么区别? 最佳答案 来自 Mozilla
另一位 Web 开发人员希望卡住最左边的列并允许滚动表格。他找到了这段代码并将其实现到他客户的网站中。该代码完成其工作并按预期工作。 但是,他添加了一些 @media 查询,以使表格的响应速度更快。当
经过编辑使问题更简洁。 我可以在 .css() 方法中使用 outerWidth() 值来将“#item”的位置偏移其宽度的两倍。 例如: $("#item").css("left", - (2 x
我正在根据这篇文章中建议的内容使用调整 Jqgrid 列宽度, Jqgrid Column width According to Its Content 在 jqgrid 的 loadcomplete
我想绝对定位我的动画扣,这是我的 html: lorem.ipsum LOREMSIT.DOLOR []Lorem ipsum dolor sit amet, consect
在 chrome 中打开控制台(同时在 SO 上)并复制 innerWidth + "|"+outerWidth + "|"+ screen.width,对我来说这将返回 2133|1920|1920
关闭。这个问题是not reproducible or was caused by typos .它目前不接受答案。 这个问题是由于错别字或无法再重现的问题引起的。虽然类似的问题可能是on-top
我是一名优秀的程序员,十分优秀!