Skip to content

Instantly share code, notes, and snippets.

View haruncpi's full-sized avatar

Md.Harun-Ur-Rashid haruncpi

View GitHub Profile
@haruncpi
haruncpi / check-if-element-in-viewport-on-scroll.js
Created March 17, 2020 03:20 — forked from EvanHerman/check-if-element-in-viewport-on-scroll.js
Check when an element comes into view (jQuery)
function isOnScreen(elem) {
// if the element doesn't exist, abort
if( elem.length == 0 ) {
return;
}
var $window = jQuery(window)
var viewport_top = $window.scrollTop()
var viewport_height = $window.height()
var viewport_bottom = viewport_top + viewport_height
var $elem = jQuery(elem)
@haruncpi
haruncpi / customroutes.php
Created September 17, 2018 11:47 — forked from samhernandez/customroutes.php
A simple class to add custom routes to Wordpress.
<?php
/**
* A class to create simple custom routes.
*
* Example usage:
*
* $theme_routes = new CustomRoutes();
* $theme_routes->addRoute(
*