PHP code example of davidmars / pov-2018
1. Go to this page and download the library: Download davidmars/pov-2018 library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
davidmars / pov-2018 example snippets
javascript
/**
* ajoute ou enlève la classe .in-viewport sur les éléments .visible-in-viewport
*/
function visibleInViewport(){
$('.visible-in-viewport').each(function() {
if ($(this).isInViewport()) {
$(this).addClass("in-viewport")
} else {
$(this).removeClass("in-viewport")
}
});
}
//écouteurs DOM
//tous les éléments
$("*").on('scroll', function() {
visibleInViewport();
});
//la fenêtre
$(window).on('resize scroll', function() {
visibleInViewport();
});