Skip to content

Instantly share code, notes, and snippets.

@webjp1
Created January 8, 2020 19:47
Show Gist options
  • Select an option

  • Save webjp1/a8da6f1d3ae3a495411127ade3341353 to your computer and use it in GitHub Desktop.

Select an option

Save webjp1/a8da6f1d3ae3a495411127ade3341353 to your computer and use it in GitHub Desktop.

Revisions

  1. webjp1 created this gist Jan 8, 2020.
    13 changes: 13 additions & 0 deletions on-viewport-plugin-js-example.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    $('#checkIfIsOnViewport').click(function(){
    $('.testToSeeIfIsOnViewport').OnViewport(function(){
    // Element is on viewport
    // alert("Element Is On Window Viewport");
    console.log($(this));
    $(this).fadeOut();
    },function(){
    // Element is not on Viewport
    // alert("Element is not on Window Viewport");
    console.log($(this));
    $(this).fadeIn();
    });
    });