Skip to content

Instantly share code, notes, and snippets.

View origamid's full-sized avatar

André origamid

View GitHub Profile
<?php
/*
* Resize images dynamically using wp built in functions
* Victor Teixeira
*
* php 5.2+
*
* Exemplo de uso:
*
* <?php
@origamid
origamid / smooth-scroll.js
Last active July 21, 2022 15:23 — forked from clemlatz/smooth-scroll.js
Smooth Scroll Animation - JavaScript
/**
* Smooth scroll animation
* @param {int} endX: destination x coordinate
* @param {int} endY: destination y coordinate
* @param {int} duration: animation duration in ms
*/
function smoothScrollTo(endX, endY, duration) {
const startX = window.scrollX || window.pageXOffset;
const startY = window.scrollY || window.pageYOffset;
const distanceX = endX - startX;