Trying to adjust the margin-top of a div to 100% of screen height within an iframe seems to be causing issues with jQuery, as it either returns 0 or inaccurate values.
While CSS3's 100vh can work as an alternative, it may not be supported in older and mobile browsers.
Are there any other solutions available?
Edit:
It should be noted that only JavaScript, HTML, and CSS can be used for this task.
Edit2:
A demo is available here: CodePen
Edit3:
Although initially experiencing difficulties with JQuery on Tumblr, it was discovered that obtaining the screen height using JQuery is possible. The issue appears to be specific to Tumblr customization pages; more details below.
During testing, a peculiar behavior was observed where browser-related information retrieved through JQuery always pertains to the "Actual Page," rather than the preview (iFrame) displayed on the right. This inconsistency seems to stem from faulty design, considering everything functions correctly on the final blog page.
To address this problem, a workaround involving $(document).ready was implemented successfully on the actual blog page. However, the same approach did not work on the customize page. Instead, wrapping the code in $(window).resize and selectively applying it to the customize page allowed for proper functionality. The reason behind this discrepancy remains unclear.
If anyone has insights into why this occurs, your input would be greatly appreciated.