Document.write nondestructive alternative

16 Views Asked by At

I'm currently using this to relocate an element if the user accesses the page via portrait mode:

<script>if(window.innerHeight > window.innerWidth){ document.write('<div id="bigdiv2" style="position:relative; top: 70px; left: -410px;">');}
</script>
Element
<div>

However, due to the destructive nature of document.write aswell as other scripts taking precedence, this completely overwrites the page onload.

Is there a better alt. (append ?) to make this work ?

0

There are 0 best solutions below