81365

How to do horizontal parallax scrolling

Question:

I'm using the latest version of Bootstrap, JQuery, and Skrollr.

I would like to have a static background and a couple scenes that occur as you scroll by parallax scrolling. I'm able to make scenes as you scroll but I'm looking for a way to where it appears that you are not moving down the page.

I'm looking to make a scene like this image:

<a href="http://upload.wikimedia.org/wikipedia/commons/3/34/Parallax_scrolling_example_scene.gif" rel="nofollow"><img alt="example" class="b-lazy" data-src="https://i.imgur.com/LpDDbF9.gif" data-original="https://i.imgur.com/LpDDbF9.gif" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" /></a>

Notice how it moves right-left but never appears like you are actually scrolling down the page.

That's the best I can explain it. Can't seem to find any good tutorials to accomplish this. Any help in the right direction would be outstanding.

Answer1:

As mentioned in the comments, horizontal scrolling isn't supported by skrollr, but you can do something else:

You can use the vertical scrollbar to animate elements in a horizontally.

Here's a Stack Overflow post on <a href="https://stackoverflow.com/questions/25289028/issue-horizontal-scrolling-effect-with-skrollr" rel="nofollow"><strong>Horizontal scrolling effect with Skrollr</strong></a><br /> And here's a working demo in <a href="http://jsfiddle.net/09wyzte5/" rel="nofollow"><strong>jsFiddle from that post</strong></a>

Hope this gets you going.

Answer2:

<a href="https://github.com/pixxelfactory/jInvertScroll" rel="nofollow">jInvertScroll</a> allows for horizontal scrolling and supports parallax.

Here's an article on how to <a href="http://www.webdesignermag.co.uk/tutorials/create-horizontal-parallax-scrolling-with-jinvertscroll/" rel="nofollow">create horizontal parallax scrolling with jInvertScroll</a>

Just use different values for horizon and middle scroll

<pre class="lang-html prettyprint-override"><div class="horizon scroll"> <img src="http://i.imgur.com/IImTBHM.png" alt="Background" /> </div> <div class="middle scroll"> <img src="http://i.imgur.com/e2pwKbv.png" alt="Clouds and Baloons" /> </div>

<strong>Here's a demo in stack snippets</strong>:

<blockquote>

<strong>Note</strong>: Try viewing in <strong>full page</strong>

</blockquote>

<pre class="snippet-code-js lang-js prettyprint-override">(function($) { $.jInvertScroll(['.scroll']); }(jQuery)); <pre class="snippet-code-css lang-css prettyprint-override">html, body { padding: 0; margin: 0; font-family:'Open Sans', sans-serif; font-weight: 300; font-size: 16px; color: #555; background: #9fdefd; } h1, h2 { color: #238acb; } .horizon { line-height: 0; z-index: 100; width: 3000px; } .middle { line-height: 0; z-index: 250; width: 4500px; } .front { z-index: 500; top: 150px; width: 6000px; } .intro { position: absolute; left: 500px; top: 0px; padding-right: 50px; background: url('http://i.imgur.com/3woqwh2.png') no-repeat right 5px; } .page { position: absolute; top: 0px; width: 500px; background: white; padding: 10px 30px; border: 1px #eee solid; } .panel1 { left: 1500px; } .panel2 { left: 2575px; } .panel3 { left: 3800px; } .panel4 { left: 5100px; } <pre class="snippet-code-html lang-html prettyprint-override"><link href="http://www.pixxelfactory.net/jInvertScroll/css/jInvertScroll.css" rel="stylesheet"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="http://www.pixxelfactory.net/jInvertScroll/js/jquery.jInvertScroll.js"></script> <div class="container"> <div class="horizon scroll"> <img src="http://i.imgur.com/IImTBHM.png" alt="Background" /> </div> <div class="middle scroll"> <img src="http://i.imgur.com/e2pwKbv.png" alt="Clouds and Baloons" /> </div> <div class="front scroll"> <h1 class="intro">Scroll down

<div class="panel1 page"> <h2>The Hot Air Balloon</h2> </div> <div class="panel2 page"> <h2>How they work</h2> </div> <div class="panel3 page"> <h2>Practicalities</h2> </div> <div class="panel4 page"> <h2>Section 4</h2> </div> </div> </div>

Recommend

  • Sending mail with ASP.NET
  • cross compilation of opencv for ARM 9 processor
  • How do you use an fbx file in OpenGL on iOS?
  • Record, modify pitch and play back audio in real time on iOS
  • how to correctly return std::list from dll
  • How to determine printer's postscript support using Win32 API?
  • Is the content element used in Polymer 1.0?
  • Producing n rows per group
  • DragDrop-Support of PictureBox-Control
  • How to reload Oracle APEX 5.0 Tree dynamically
  • How to style GCKUIMiniMediaControlsViewController in iOS?
  • What is the best data type to store boolean values in a database
  • How to execute Blackberry OS 6 app in Blackberry 10 OS
  • Add Jpanel to Jframe NetBeans
  • How to convert Neo4j Result to GraphJSON
  • Recursion in ASP.NET Core Razor views
  • PHP: Get HTTP Protocol Version (HTTP/1.1 vs HTTP/2)
  • Where in the relevant specification is it documented that some comments in a SQL script are, in fact
  • Special chars in Amazon S3 keys?
  • Does SmartGit support git-svn?
  • SQL append distinct values from two columns and two tables
  • HALF_PTR Windows data type
  • Is there a way to clone native functions in javascript like window.alert or document.write
  • custom string delimiters stringtemplate-4
  • Angular Bootstrap Carousel Slide Transition not working correctly
  • SIP API media codecs
  • cell spacing in div table
  • JQuery .html() remove line break on IE 8
  • How to clear text inside text field when radio button is select
  • Why ng-show works with ng-repeat but ng-if doesn't? [duplicate]
  • Resize panoramic image to fixed size
  • Adding custom controls to a full screen movie
  • Comma separated Values
  • Matrix multiplication with MKL
  • How to get icons for entities from eclipse?
  • Error creating VM instance in Google Compute Engine
  • Hits per day in Google Big Query
  • how does django model after text[] in postgresql [duplicate]
  • File not found error Google Drive API
  • Converting MP3 duration time