This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
//hide the checkboxes | |
$('.ginput_container_checkbox li input').hide(); | |
//inject the custom checkbox code | |
$('.ginput_container_checkbox li input').before('<div class="custom_checkbox"><div class="check_inner"></div></div>'); | |
//control the new checkbox on click | |
$('.ginput_container_checkbox li').on('click', '.custom_checkbox', function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//vertically align element to the middle of its parent | |
function vAlign(){ | |
if(jQuery('.v-align').length){ | |
var jQueryvaChild = jQuery('.v-align'); | |
jQueryvaChild.each(function(){ | |
var vaChildHeight = jQuery(this).height(); | |
var vaParentHeight = jQuery(this).parent().height(); | |
var topOffset = (vaParentHeight - vaChildHeight) / 2; | |
jQuery(this).css('paddingTop', topOffset).addClass('show'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Field text - remove on focus, replace on blur | |
function fieldText(){ | |
var $fieldText = jQuery('.js-text'); | |
$fieldText.focus(function(){ | |
var fText = jQuery(this).data("fieldtext"); | |
var fVal = jQuery(this).val(); | |
if(fVal === fText){ | |
jQuery(this).val(""); | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//truncate a string...nicely | |
function stringTruncate($string, $stringLength){ | |
if (strlen($string) > $stringLength) { | |
$string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $stringLength)); | |
return $string . '...'; | |
}else{ | |
return $string; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Replace all SVG images with inline SVG | |
$('img.svg').each(function(){ | |
var $img = $(this); | |
var imgID = $img.attr('id'); | |
var imgClass = $img.attr('class'); | |
var imgURL = $img.attr('src'); | |
$.get(imgURL, function(data) { | |
// Get the SVG tag, ignore the rest | |
var $svg = $(data).find('svg'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var rtime; | |
var timeout = false; | |
var delta = 200; | |
$(window).resize(function() { | |
rtime = new Date(); | |
if (timeout === false) { | |
timeout = true; | |
setTimeout(resizeend, delta); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.disable-link').click(function (event) { | |
event.preventDefault(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//match height of elements | |
function matchHeight($element) { | |
var heighest = 0; | |
$element.each(function () { | |
var elemHeight = $(this).outerHeight(); | |
if (elemHeight > heighest) { | |
heighest = elemHeight; | |
} | |
}); | |
$element.css('height', heighest); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var rtime; | |
var timeout = false; | |
var delta = 200; | |
$(window).resize(function() { | |
rtime = new Date(); | |
if (timeout === false) { | |
timeout = true; | |
setTimeout(resizeend, delta); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin vertical-align { | |
position: relative; | |
top: 50%; | |
-webkit-transform: translateY(-50%); | |
-ms-transform: translateY(-50%); | |
transform: translateY(-50%); | |
} | |
.mixin p { | |
@include vertical-align; |
NewerOlder