Based on this answer Overlaying divs on a scrollbar I'm trying to make the same effect.
When you scroll through sections, they overlap each other in the same place - one stacked from top to top.
In firefox - IE works fine, but on chrome (the latest version is version 31.0.1650.63 m), when you scroll and the next slide starts to flow, the contents of the section that overlaps bounce.
Logics:
When the next slide / section arrives, set position:fixed; to the section that will overlap.
Basic html
<section class="section"> <div class="section-inner"> <div class="table-cell"> <div class="container clearfix"> //conten goes here with img etc. </div> </div> <img src="imgsrc" class="secondary-background-image"> </div> </section>
css:
html, body { height: 100%; margin: 0; padding: 0; } body { overflow-x: hidden; } .section { position: relative; z-index: 5; background: #FFFFFF; } .section-fixed { z-index: 1; } .section-inner { width: 100%; height: inherit; display: table; } .section-fixed .section-inner { position: fixed; top: 0; left: 0; z-index: 2; } .table-cell { width: 100%; display: table-cell; vertical-align: middle; height: inherit; } .section .secondary-background-image { position: absolute; bottom: 0; left: 0; } .container { position: relative; width: 700px; margin: 0 auto; padding: 0; } .clearfix:before, .clearfix:after { content:" "; display: table; } .clearfix:after { clear: both; }
Base js:
$(function() { // Set up vars var _window = $(window), panels = $('.section'), winH = _window.height(); panelsY = []; // Cache position of each panel $.each(panels, function(i, el) { $(this).css('height', winH); panelsY.push(panels.eq(i).offset().top); }); // Bind our function to window scroll _window.bind('scroll', function() { updateWindow(); }); // Update the window function updateWindow() { var y = _window.scrollTop(); // Loop through our panel positions for (i = 0, l = panels.length; i < l; i++) { /* Firstly, we break if we're checking our last panel, otherwise we compare if he y position is in between two panels */ if ((i === l - 1) || (y >= panelsY[i] && y <= panelsY[i+1])) { break; } }; // Update classes panels.not(':eq(' + i + ')').removeClass('section-fixed'); panels.eq(i).addClass('section-fixed'); }; });
A plain text work file in the form of content http://jsfiddle.net/amustill/wQQEM/
The jsfiddle file works in chrome because the layout is very simple and divs does not have screen height. On my site, I think because divs takes up the height of the screen and I have a lot of images, text, etc. A problem arises.
Thus, the problem arises at the moment when the section fixes the class section and the position of the-inner section is fixed.
EDIT
I put nicescroll.js to make the scroll a little smoother. The problem is still happening, but "smoother."