Note that there are some explanatory texts on larger screens.

plurals
  1. POMulti directional navigation
    primarykey
    data
    text
    <p>I'm trying to create a multi directional one page website like below or <a href="http://magazine1.suitupordie.com" rel="nofollow">this</a></p> <pre><code> [panel 1] [panel 2] [panel 3][panel 4][panel 5] [panel 6] </code></pre> <p>I know how to scroll vertical or horizontal but not together. The effect I'm looking for is similar to this.. <a href="http://jsfiddle.net/shavindra/zKxxK/39/" rel="nofollow">http://jsfiddle.net/shavindra/zKxxK/39/</a></p> <p>I want each panel to be width: 100%; height: 1000px; </p> <p>if anyone can give me a simple breakdown or point me in the right direction i'd be grateful. </p> <p>/////// EDIT + 2 ///////////////</p> <p><strike>Here is my local code but I can't replicate @Beetroot-Beetroot solution.</strike> </p> <p>This code below now works for anyone looking for a similar solution. Thanks to @Beetroot-Beetroot</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;style type="text/css"&gt; body { margin: 0px; overflow: none; } #content { width: 100%; height: 100%; position: absolute; } #scrollWrapper { position: relative; overflow: hidden; } #scroller { position: absolute; } .scrollitem { position: absolute; background: #F0F8FF; border: 1px solid black; display: none; } &lt;/style&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="content"&gt; &lt;div id="scrollWrapper"&gt; &lt;div id="scroller"&gt; &lt;div class="col1 row1 scrollitem"&gt;col1, item1&lt;/div&gt; &lt;div class="col1 row2 scrollitem"&gt;col1, item2&lt;/div&gt; &lt;div class="col1 row3 scrollitem"&gt;col1, item3&lt;/div&gt; &lt;div class="col1 row4 scrollitem"&gt;col1, item4&lt;/div&gt; &lt;div class="col1 row5 scrollitem"&gt;col1, item5&lt;/div&gt; &lt;div class="col2 row1 scrollitem"&gt;col2, item1&lt;/div&gt; &lt;div class="col2 row2 scrollitem"&gt;col2, item2&lt;/div&gt; &lt;div class="col2 row3 scrollitem"&gt;col2, item3&lt;/div&gt; &lt;div class="col2 row4 scrollitem"&gt;col2, item4&lt;/div&gt; &lt;div class="col2 row5 scrollitem"&gt;col2, item5&lt;/div&gt; &lt;div class="col3 row1 scrollitem"&gt;col3, item1&lt;/div&gt; &lt;div class="col3 row2 scrollitem"&gt;col3, item2&lt;/div&gt; &lt;div class="col3 row3 scrollitem"&gt;col3, item3&lt;/div&gt; &lt;div class="col3 row4 scrollitem"&gt;col3, item4&lt;/div&gt; &lt;div class="col3 row5 scrollitem"&gt;col3, item5&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; ​&lt;/div&gt; &lt;/body&gt; &lt;script type="text/javascript"&gt; var $scroller = $("#scroller"), $scrollitems = $(".scrollitem"), borders = { top: parseInt($scrollitems.css('border-top-width')), right: parseInt($scrollitems.css('border-right-width')), bottom: parseInt($scrollitems.css('border-bottom-width')), left: parseInt($scrollitems.css('border-left-width')) }, margin = 8, currentPage = { jq: $(), x: 0, y: 0 }, scrollTime = 1200, xPitch, yPitch, inTransition = false; $(window).on('resize', function() { $("#scrollWrapper, #scroller").height($(document).height()); $("#scrollWrapper, #scroller").width($(document).width()); $(".scrollitem").width($(document).width() - borders.left - borders.right - 2); $(".scrollitem").height($(document).height() - borders.top - borders.bottom - 2); xPitch = $(document).width() + margin, yPitch = $(document).height() + margin }).trigger('resize'); function scrollBy(coords) { //find new item relative to current coords.x += currentPage.x; coords.y += currentPage.y; return scrollTo(coords, false); }; function scrollTo(coords, noScroll) { var def = new $.Deferred(); var $newPage = $scrollitems.filter(".col" + coords.x).filter(".row" + coords.y); //if new page exists, if (!inTransition &amp;&amp; $newPage.length) { inTransition = true; //position new page and show it var left = coords.x * xPitch, top = coords.y * yPitch; $newPage.css({ 'left': left, 'top': top }).show(); //scroll to new page var t = noScroll ? 0 : scrollTime; $scroller.animate({ 'left': -left, 'top': -top }, t, function() { //hide current page (not really necessary if everything else is pixel perfect) currentPage.jq.hide(); //update currentPage to reflect new page $.extend(currentPage, {jq:$newPage}, coords); inTransition = false; def.resolve();//allow something to happen after new page is loaded }); } else { def.reject(); }//allow something to happen if new page doesn't exist return def.promise(); } //go to initial page scrollTo({x:1, y:1}, true).done(function() { //here do whatever is necessary on initial page load }); $(document).on('keydown', function(e) { e.preventDefault(); switch (e.which) { case 37: scrollBy({x:-1, y:0}); // left break; case 38: scrollBy({x:0, y:-1}); // up break; case 39: scrollBy({x:1, y:0}); // right break; case 40: scrollBy({x:0, y:1}); // down break; } }); &lt;/script&gt; ​ &lt;/html&gt; </code></pre>
    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.
    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