Skip to content

Instantly share code, notes, and snippets.

View jerewall's full-sized avatar

Jeremy Wallace jerewall

View GitHub Profile
@jerewall
jerewall / heightrick.js
Last active September 22, 2016 18:33
change height of search box on click
$('#ninja_forms_form_4_wrap').click(function(){
$(this).animate({
height: $(this).get(0).scrollHeight
}, 1000, function(){
$(this).height('auto');
});
});
@jerewall
jerewall / experimental.js
Created September 21, 2016 20:45
adding class to header on scroll for sticky header
var header = $(".header");
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll >= 1) {
header.addClass('small');
} else {
@jerewall
jerewall / header.php
Created August 2, 2016 13:15
CSS Override with theme options
<style>
body {
background: url(<?php echo get_option('bgimg'); ?>) no-repeat top center <?php echo get_option('bgcolor'); ?>; }
</style>
//*this goes in theme options*/
array('bgcolor' => 'Site Background Color', 'input'),
array('bgimg' => 'Site Background Image', 'input'),
@jerewall
jerewall / global.js
Created July 20, 2016 18:19
Image Swap Alternate Version (still beta, needs testing)
$(".gallery .thumbnails li:first").addClass('active');
$(".gallery .thumbnails li").click(function(e){
e.preventDefault();
$(".gallery .thumbnails li").each(function(k, v){
$(this).removeClass('active');
});
@jerewall
jerewall / product-template.php
Created June 16, 2016 12:45
Responsive Store Product Template
<div class="web-product">
<div class="crumbs">[1sc:breadcrumbs /]</div>
<div class="head">
<div class="title">
<h2>[1sc:product.name /]</h2>
<p class="sku">SKU: [1sc:product.sku /]</p>
</div>
<div class="price">
<p><span class="base">[1sc:product.price /]</span> [1sc:product.saleprice /] [1sc:product.onsale /]</p>
</div>
@jerewall
jerewall / global.js
Created May 25, 2016 17:50
Split 1 UL into 2 ULS using jQuery to target different sections of a page.
var newList = $('ul#cats').children('li').clone();
var numOfLis = newList.length;
$('ul#cats2').html(newList);
$('ul#cats').find('li:gt(' + Math.floor(numOfLis/2) + ')').remove();
$('ul#cats2').find('li:lt(' + Math.ceil(numOfLis/2) + ')').remove();
@jerewall
jerewall / style.css
Created May 17, 2016 16:14
Switch order of divs using CSS
<div id="wrapper">
<div id="one">One</div>
<div id="two">Two</div>
<div id="three">Three</div>
</div>
/*This is the css:*/
#wrapper {display:table;}
#one {display:table-footer-group;}
@jerewall
jerewall / global.js
Created May 16, 2016 14:08
hover text to change master image on the right with different variations (text, arrows, etc)
// hover and restore for inner pages.
var defaultFlip = $(".flipImg").attr("src");
$(".flips li").hover(function(){
var img = $(this).data("targetimg");
$(".flipImg").attr("src", img);
}, function() {
$(".flipImg").attr("src", defaultFlip);
});
@jerewall
jerewall / style.css
Created May 16, 2016 13:54
Disable Right Click
<style>
body {
-webkit-user-select: none;
-moz-user-select: -moz-none;
-ms-user-select: none;
user-select: none;
}
input, textarea {
-moz-user-select: text;
@jerewall
jerewall / functions.php
Last active May 16, 2016 13:50
Wordpress Shortcode (Easier, Shorter Version)
/* functions.php */
function lorem_function() {
return 'Custom code or content';
}
add_shortcode('customshortcodename', 'lorem_function');
<!-- To use -->
[customshortcodename]