Note that there are some explanatory texts on larger screens.

plurals
  1. POStrange behaviour of "position: relative" when zooming. What's happening?
    primarykey
    data
    text
    <p><strong>The Fiddle</strong>: <a href="http://jsfiddle.net/4WFrJ/" rel="nofollow noreferrer">http://jsfiddle.net/4WFrJ/</a></p> <p><strong>My Problem</strong>: I can't wrap my head around the behaviour of this setup. When I zoom in, the images tend to move faster, but when I zoom out, they don't move at all. Sometimes they just stop at 9.xxxxxx, even though I told them to move only by one pixel. Can you explain this?</p> <p>My browser is Chrome.</p> <p><strong>My Aim</strong>: achieve a fluid motion with the images disappearing when out of bounds of the parent element, whatever the magnification percentage.</p> <p>I am in search of the basic rules, that govern these strange processes, from which I hope to learn new things.</p> <p><strong>The Code</strong>:</p> <p><em>HTML</em>:</p> <pre><code>&lt;div id = "presentation"&gt; &lt;ul&gt; &lt;li class = "pres-item"&gt; &lt;img class = "pres-image" src = "../img/presentation/image1.jpg"&gt; &lt;/li&gt; &lt;li class = "pres-item"&gt; &lt;img class = "pres-image" src = "../img/presentation/image2.jpg"&gt; &lt;/li&gt; &lt;li class = "pres-item"&gt; &lt;img class = "pres-image" src = "../img/presentation/image3.jpg"&gt; &lt;/li&gt; &lt;li class = "pres-item"&gt; &lt;img class = "pres-image" src = "../img/presentation/image4.jpg"&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p><em>CSS</em>:</p> <pre><code>html, body { margin: 0; } #presentation { padding: 10px; width: 900px; margin: 50px auto; overflow: hidden; } #presentation ul { list-style-type: none; margin: 0; } #presentation ul li { display: inline-block; } .pres-item { height: 150px; width: auto; position: relative; left: 0; } .pres-image { width: inherit; height: inherit; } </code></pre> <p><em>JS</em> (with jQuery):</p> <pre><code>$(document).ready(function(){ var presentation = $('#presentation'); var interval = setInterval(function() { console.log('intervaling'); $('.pres-item').css('left', '+=1'); }, 60); }); </code></pre> <p><strong>The Image</strong>:</p> <p><img src="https://i.stack.imgur.com/S6AZU.png" alt="The fixed position at 90% zoom"></p> <p><strong>The Thanks</strong>:</p> <p>THANKS PEOPLE (in advance)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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