Swap The Background Image As You Scroll Plugin

jQuery Scroll Background Swap is to toggle the background image of an element while scrolling down. Scroll Swap is a jQuery plugin that automatically switches background images for page sections as you scroll down.

The plugin also has the ability to make background images perfectly positioned so that you see the effect of subtle parallax scrolling when scrolling through sections of the page.

How to make use of it:

1. Download and place the jquery-scroll-swap.js script after the most recent jQuery library.

<script src="/path/to/cdn/jquery.min.js"></script>
<script src="/path/to/js/jquery-scroll-swap.js"></script>

2. Specify background photographs for every web page part utilizing the data-image attribute:

<div class="scroll-graphic">
  <div data-image="bg-1.jpg">
    ... Any Content Here
  </div>
  <div data-image="bg-2.jpg">
    ... Any Content Here
  </div>
  <div data-image="bg-3.jpg">
    ... Any Content Here
  </div>
  ...
</div>

3. Call the perform scrollSwap on the parent container and accomplished.

$(function(){
  $('.scroll-graphic').scrollSwap();
});

4. Determine how to remove from the top of the web page to activate the picture swapping.

$('.scroll-graphic').scrollSwap({
  triggerFromTop: 0.75, // 75%
});

5. Specify the animation pace.

$('.scroll-graphic').scrollSwap({
  speed: 0.7
});

6. Override the default HTML information attribute:

$('.scroll-graphic').scrollSwap({
  dataImageAttribute: 'data-image'
});

Options

You can include these options during instantiation.

  • dataImageAttribute – Change the default attribute used to find the image. i.e. data-image="picture1.jpg"
  • triggerFromTop – The percentage from the top of the viewport when the background should trigger. A 1 means as it comes into view. 0.5 is in the middle of the screen.
  • speed – Speed of cross dissolve.
  • noCSS – Use your own CSS and disregard all of the built-in default CSS.
  • spreadDistance – How many pixels/vh are between the text elements.
  • backgroundColor – The background color of the text boxes
  • width – The width of each text box.

Swap Out Background Images On Scroll, jQuery Scroll Background Swap Plugin/Github, change image on scroll, css background image scroll animation


See Demo And Download

Official Website(jrue): Click Here

This superior jQuery/javascript plugin is developed by jrue. For extra Advanced Usage, please go to the official website.

Share