detect if seen scroll - Free Download Detect If An Element Is Seen On Scroll - jQuery See.js

Free Download Detect If An Element Is Seen On Scroll – jQuery See.js

Posted on

This time I will share jQuery Plugin and tutorial about Detect If An Element Is Seen On Scroll – jQuery See.js, hope it will help you in programming stack.

detect if seen scroll - Free Download Detect If An Element Is Seen On Scroll - jQuery See.js
File Size: 40.3 KB
Views Total: 574
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

See.js is a small jQuery plugin (0.5 kb minified) for detecting if the user has scrolled to an element on the page or not.

Very useful for landing pages that animate the desired elements when they’re scrolled in or out of the viewport.

How to use it:

1. Include the see.js script after jQuery JavaScript library.

1 <script src="/path/to/cdn/jquery.min.js></script>
2 <script src="/path/to/src/see.js"></script>

2. Attach the function to the target element and pass the following parameters:

  • height: The height of the window where the element is “seen”. This string can be a percentage (of the window height, specified using a percentage symbol (%)), or pixels. (specified with either no units or “px”).
  • callback: Called when the element is “seen”.
  • exitCallback: Called when the element is “unseen”.
1 <div class="el">
2   Element To Animate On <a href="https://www.jqueryscript.net/tags.php?/Scroll/">Scroll</a>
3 </div>
01 $(document).ready(function() {
02   $(".el").see(
03     "90%",
04     function() {
05       $(this).addClass("visible");
06     },
07     function() {
08       $(this).removeClass("visible");
09     }
10   );
11 });

4. Animate the element using CSS animations.

1 .visible {
2   /* CSS <a href="https://www.jqueryscript.net/animation/">Animation</a> Rules Here */
3 }

5. There is a real world example that shows how to use Animate.css to animate the element when scrolling down the web page.

1 $(document).ready(function() {
2   $(".el").see("90%", function() {
3     $(this).addClass("animated jello");
4   });
5 });

This awesome jQuery plugin is developed by carsonalh. For more Advanced Usages, please check the demo page or visit the official website.

source : jquery.net