Note that there are some explanatory texts on larger screens.

plurals
  1. POExtending a background using Javascript
    primarykey
    data
    text
    <p>I have a page that looks like this</p> <pre><code>----------------------------------- | ************* | | ************* | | ************* | | ************* | | ************* | | ************* | ----------------------------------- </code></pre> <p>The outer frame is the browser edge and thus the <code>&lt;body&gt;</code>, and the stars are a centred background image on the <code>&lt;body&gt;</code> element.</p> <p>Now, using javascript I'd like to add some aboslutely positioned DIVs each side of that background in order to extend it:</p> <pre><code>----------------------------------- |*********|*************|*********| |*********|*************|*********| |*********|*************|*********| |*********|*************|*********| |*********|*************|*********| |*********|*************|*********| ----------------------------------- </code></pre> <p>As the window is resized the centred background will move (to remain in the center of the window), so the divs on each side should move in consequence.</p> <p>Can anyone please suggest an approach to solving this issue?</p> <p>Side note on why I'm doing this:</p> <p>The background is large image, and I wish to have it repeated across the screen by flipping it as described here:</p> <p><a href="https://stackoverflow.com/questions/13287090/background-flipped-tiling-using-javascript">Background flipped tiling using Javascript</a></p> <p>The actual process of flipping was discussed in that question, whereas this question deals with the CSS/Javascript aspect of positioning.</p> <p>Note that in the case of non-capable browsers I'm happy leave the page as it is in the first diagram, with only the centred background.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload