title: Diagonal Scroll Javascript
body: <p>i got a issue here. Im trying to scroll diagonally my document. It takes the doc width and height and adds its values in each section element. I know how to scroll it in y angle, but cand find a way to make the x angle scroll synchronously scroll width the y angle.</p>
  
  <p>Thanks for any tip!</p>
  
  <p>Here's my js:</p>
  
  <pre><code>$(function() {
      var windowHeight = $(window).height();
      var windowWidth = $(window).width();
      var sectionsNumbers = $("#content section").length - 1;
      var sectionCount = 0;
      // Scroll sets
      var windowScrollX = ((sectionsNumbers + 1) * windowWidth) - windowWidth;
      alert(windowScrollX);
      // Set mask w and h
      $("#mask").css("width", windowWidth);
      $("#mask").css("height", windowHeight);
      $(".scrollRule").css("height", (sectionsNumbers + 1) * windowHeight);
      $("#content section").each(function() {
          // Defines its width and height
          $(this).css("width", windowWidth);
          $(this).css("height", windowHeight);
          // Defines its position
          $(this).css("left", sectionCount * windowWidth);
          $(this).css("top", sectionCount * windowHeight);
          sectionCount++;
      });
      // When window scrolls
      $(window).scroll(function() {
          var curScrollTop = $(window).scrollTop();
          $("#debug").html(curScrollTop);
          $("#content").css("top", "-" + curScrollTop);
      });
  });​
  </code></pre>
  
  <p><strong>I GOT IT!</strong></p>
  
  <p>I just have to divide the window total width by the window total scroll height. Thanks to all!</p>