做完之后
$view.offset({
left : X, //X is the same each time
top : this.y
});
console.log($view.offset()); //outputs what it should
对于几个对象。我看到(在萤火虫中)以下html代码
<div id="4017" class="text-block" style="position: relative; top: 2px; left: 22px;">
<div id="4043" class="text-block" style="position: relative; top: 41px; left: -64px;">
<div id="4053" class="text-block" style="position: relative; top: 80px; left: -95px;">
<div id="4081" class="text-block" style="position: relative; top: 119px; left: -135px;">
left
对于所有 div 应该是相同的(并且它被显示,所以 ifleft
对于 each 是相等的div
)。尽管显示了,但为什么left
每个 div 都不相同,所以所有 div 都相同?div
left
在 CSS 中,我有:
div.text-block {
display: inline-block;
}
先感谢您!
UPD: div 位于其他三个 div 旁边:
<div id="app-container">
<div id="canvas-container">
<div id="canvas">
<!-- divs are located here -->
</div>
</div>
</div>
在相应的 CSS 中,我有:
#canvas {
position: absolute;
background-color: white;
width: 100%;
height: 100%;
}
#app-container {
height: auto !important;
min-height: 100%;
}
#canvas-container {
position: absolute;
width: 100%;
height: 100%;
overflow: hidden;
}