Advertisement
Guest User

Untitled

a guest
Mar 20th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.14 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.    <head>
  4.       <style>
  5.          html,body{
  6.          margin:0;
  7.          padding:0;
  8.          width:100%;
  9.          height:100%
  10.          }
  11.          #HScroll{
  12.          width:100%;
  13.          height:100%;
  14.          overflow-y : hidden;
  15.          overflow-x : scroll;
  16.          }
  17.          #HScrollContent{
  18.          display:block;
  19.          width:200%;
  20.          height:100%;
  21.          overflow-y : hidden;
  22.          }
  23.          #one{width:50%;background:blue; height:100%;display: inline-block;}
  24.          #two{width:50%; background:red; height:100%;display: inline-block;}
  25.       </style>
  26.    </head>
  27.    <body>
  28.       <div id="HScroll">
  29.          <div id="HScrollContent">
  30.             <div id="one"></div>
  31.             <div id="two"></div>
  32.          </div>
  33.       </div>
  34.       <script>
  35.          (function() {
  36.              var myHDiv = document.getElementById('HScroll');
  37.              
  38.             myHDiv.onmousewheel = function(e,delta){
  39.                // console.log(e);
  40.                 myHDiv.scrollLeft += (e.deltaY);
  41.                 e.preventDefault();
  42.             }
  43.          })()
  44.       </script>
  45.    </body>
  46. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement