After doing
$view.offset({
left : X, //X is the same each time
top : this.y
});
console.log($view.offset()); //outputs what it should
for several objects. I saw (in firebug) the following html code
<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 should be the same for all divs (and it’s displayed so if left is equal for each div). Why left is not the same for each div despite it’s shown so that left is the same for all divs?
In CSS I have:
div.text-block {
display: inline-block;
}
Thank you in advance!
UPD: divs are located iside three other divs:
<div id="app-container">
<div id="canvas-container">
<div id="canvas">
<!-- divs are located here -->
</div>
</div>
</div>
In respective CSS I have:
#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;
}
As said in jQuery documentation,
So if your elements are in other elements not positioned on position (0, 0) relative to the document, there is an offset applied.
EDIT
Relatively positioned inline elements with same left value :