Get offsetParent as null

problem description

when the image is loaded lazily and the encapsulation method obtains the offset-related value of the element, offsetParent always explains for null,mdn that if the dispaly of the element is none or the offsetPsrent obtained when the element is body, it will be null, but does not belong to both cases. What is the problem?

Source address

https://smileyby.github.io/pi.

Apr.22,2021

less.js hides body before the style file is compiled to prevent the page from flickering due to style updates.

when your script acquires offsetParent, the style in the page has not yet been compiled, and the display setting of body will be set to none. by less So you can't get offsetParent.

.

clipboard.png

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1beab68-31a15.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1beab68-31a15.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?