Note that there are some explanatory texts on larger screens.

plurals
  1. POHorizontal scrolling layout LEFT/RIGHT: jQuery/CSS quiz
    primarykey
    data
    text
    <p>It seems, that what I am trying to achieve is almost impossible.</p> <p>I am trying to create a <strong>horizontal layout</strong> dependant on jQuery, but usable even with Javascript being turned off. I also want the cleanest code possible with its semantic value kept. So I guess I'm looking to the ultimate solution. :)</p> <p>The most common horizontal layout on the web is this: <a href="http://www.queness.com/resources/html/scroll/horizontal.html" rel="nofollow">http://www.queness.com/resources/html/scroll/horizontal.html</a> - This would be perfect (it works even with JS being turned off). My problem is I need to make it work "both ways" (left and right with "starting" item in the middle).</p> <p>The effect should be similar as this: <a href="http://steveandjacqs.com/" rel="nofollow">http://steveandjacqs.com/</a> The website (and the coding backend) is great, but it is unusable without JS and the code is full of hacks.</p> <p>My CSS: </p> <pre><code>html,body { overflow: hidden; } .wrapper { position: relative; width: 100%; height: 100%; } .wrapper-cont { position: relative; width: 500%; height: 100%; margin-left: -200%; } #item-left { position: absolute: top: 0px; left: 0%; } #item-home { position: absolute; top: 0px; left: 200%; } #item-right{ position: absolute; top: 0px; left: 400%; } #item-down { position: absolute; top: 200%; left: 0%; } </code></pre> <p>My HTML:</p> <pre><code>&lt;body&gt; &lt;nav&gt;&lt;ul&gt; &lt;li&gt;&lt;a href="#item-left"&gt;Left&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#item-home"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#item-right"&gt;Right&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#item-down"&gt;Down&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;&lt;/nav&gt; &lt;div class="wrapper"&gt; &lt;div class="wrapper-cont"&gt; &lt;div id="item-left"&gt;Element outside viewport on the left side&lt;/div&gt; &lt;div id="item-home"&gt;Element on the center of viewport&lt;/div&gt; &lt;div id="item-right"&gt;Element outside viewport on the right side&lt;/div&gt; &lt;div id="item-down"&gt;Element on the center of viewport but down&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; </code></pre> <p>My JAVASCRIPT will use some sort of smooth animation plugin (scrollTo maybe?) between the sections. Browser scrolling (at least vertical) should be disabled, the DIVs itselves should be scrollable.</p> <p>///</p> <p>Should I post screenshot of my website or is it understanble this way?</p> <p>Thank you in advance!</p> <p>PS: I am more or less jQuery copypasta, so go easy on me please. :)</p> <h1>UPDATE</h1> <p>What about modifying .htaccess to add internal link on entering the homepage: to rewrite "http://example.com" to "http://example.com#home"? Than I can code the layout "the common way" (such as in previous example from Queness). </p>
    singulars
    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