Skip to content

Instantly share code, notes, and snippets.

@yankiara
yankiara / scroll-direction.js
Last active May 27, 2022 09:32
Scroll direction for sticky header/footer, etc.
window.addEventListener( 'DOMContentLoaded', ()=> {
const body = document.body,
scrollUp = "scroll-up",
scrollDown = "scroll-down",
offset = 0;
let lastScroll = window.pageYOffset;
if ( lastScroll > offset ) {
body.classList.add(scrollUp);
@yankiara
yankiara / defer-youtube-load-with-thumbnail.php
Created June 1, 2022 18:13
Defer loading of YouTube player
<?php
add_shortcode( 'pavenum_video', function( $atts ) {
$a = shortcode_atts( array(
'id' => '',
'ratio' => '',
/*'legend' => '',*/
'alt' => ''
), $atts );