Skip to content

Instantly share code, notes, and snippets.

View dannydickson's full-sized avatar

Danny D. dannydickson

View GitHub Profile
@dannydickson
dannydickson / vanilla-smooth-scroll.js
Last active January 13, 2017 21:41
Vanilla JS Smooth Scroll
// Smooth Scroll
$(function() {
$('a[href*="#"]:not([href="#"])').click(function() {
if (location.pathname.replace(/^\//,'') === this.pathname.replace(/^\//,'') && location.hostname === this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html, body').animate({
scrollTop: target.offset().top
}, 1000);
@dannydickson
dannydickson / add-div-to-blog-page.php
Last active January 13, 2017 21:41
Add custom div to blog page
// add custom div to blog page
function my_content($content) {
global $post;
return '<div class="blog-wrap">'.$posts.'</div>';
}
add_filter('the_content', 'my_content');
@dannydickson
dannydickson / fit-to-parent.js
Created June 7, 2016 15:34
Fit to Parent JS
jQuery.fn.fitToParent = function (options) {
this.each(function () {
// Cache the resize element
var $el = jQuery(this);
// Get size parent (box to fit element in)
var $box;
if( $el.closest('.size-parent').length ) {
@dannydickson
dannydickson / functions.php
Last active January 16, 2017 21:53 — forked from benweiser/Add A Genesis Featured Image Above Post With Title - Style.css
Add A Genesis Featured Image Above Post With Title
// Hook after header area
add_action( 'genesis_after_header', 'gd_featured_image_title' );
function gd_featured_image_title() {
// If it is a page and has a featured thumbnail, but is not the front page do the following...
if (has_post_thumbnail() && is_single() ) {
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );