who can tell me what's the different between style.left and element.offsetLeft, is it same?
element.offsetLeft Returns the number of pixels that the upper left corner of the current element is offset to the left within the offsetParent node.
elem.style.left it's a get of property left of style attribute
You can set the style.left - it is user definable and can even remain blank, while offsetLeft is always read-only and always has a value - current position.
element.offsetLeft returns the distance from the left edge of the node to the parent node in pixels.
style.left is the CSS Style for the node, and may be in any of these formats:
CSS Unit Formats
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With