Skip to content

Instantly share code, notes, and snippets.

/**************************
* Movie controls
*************************/
if($("#lens-video").length) {
var moviecontainer = document.getElementById("lens-video"),
movie = moviecontainer.querySelector("video"),
controls = moviecontainer.querySelector("span");
movie.removeAttribute("controls");
controls.style.display = "block";
$(function () {
$(".staff-filter__menu li").on('mouseenter mouseleave', function (e) {
if ($(this).children('ul').length) {
var elm = $(this).children('ul');
var off = elm.offset();
var l = off.left;
var w = elm.width();
var docW = $(window).width();
var isEntirelyVisible = (l + w + 20 <= docW);
/*================================================
= Anchor tag scroll hijack =
================================================*/
// Select all links with hashes
$('a[href*="#"]')
// Remove links that don't actually link to anything
.not('[href="#"]')
.not('[href="#0"]')
.click(function(event) {
// On-page links
/*===============================================
= Auto play youtube video =
===============================================*/
var videosrc=$("iframe").attr("src")+"&autoplay=1";
$("iframe").attr("src",videosrc);
/*===== End of Auto play youtube video ======*/
(function($) {
var resizeTimer; // Set resizeTimer to empty so it resets on page load
function resizeFunction() {
// Add functions here
}
// On resize, run the function and reset the timeout
// 250 is the delay in milliseconds. Change as you see fit.
@chrisjreber
chrisjreber / Mobile Menu Arrow Dropdown
Created July 7, 2017 18:21
Adds a clickable arrow to open mobile submenus
// arrow-down.svg
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="10" viewBox="0 0 16 10"><defs><style>.\33 1fe686d-9374-4003-9b83-d81c4a6d3d09{fill:#A3322A;}</style></defs><title>arrow-down</title><g id="be17913f-2c50-43f6-bd06-b26bc8c02d6a" data-name="Layer 2"><g id="142fe3b1-0c71-4a5c-b4b4-3b547d209226" data-name="Layer 1"><polygon class="31fe686d-9374-4003-9b83-d81c4a6d3d09" points="8 10 16 0 0 0 8 10"/></g></g></svg>
// JS file
/*============================
= Menu =
============================*/
$('.menu-item-has-children').each(function() {
$(this).append('<span class="menu-item-arrow inactive"></span>');
add_filter( 'jpg_quality', 'high_jpg_quality' );
function high_jpg_quality() {
return 100;
}
// Add to footer.php before </body> closing tag
<?php if(is_user_logged_in()):
?>
<!--
DeBugger - breakpoint indicator
Inspired by Darin @ Meta13
-->
<div class="breakpoint-indicator"></div>
<?php endif; ?>
@chrisjreber
chrisjreber / gist:0996b0a014986a5ace3e9136c6505242
Created November 15, 2017 15:59
WordPress CSS file version to prevent cache issues
// Enqueue the main Stylesheet.
$style_ver = filemtime( get_stylesheet_directory() . '/assets/stylesheets/foundation.css' );
wp_enqueue_style( 'main-stylesheet', get_template_directory_uri() . '/assets/stylesheets/foundation.css', array(), $style_ver, 'all' );
@chrisjreber
chrisjreber / Sticky header
Last active December 27, 2017 15:24
sticky header nav. hide on scrolldown past point X and appear on scrollup past X scrollup distance
<script>
$( document ).ready(function() {
var distance = 0;
if ($(".toggle-menu").css('display') == 'none') {
// Hide Header on on scroll down
var didScroll;
var lastScrollTop = 0;
var delta = 5;
var navbarHeight = $('#site-header').outerHeight();