This file contains hidden or 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
#key-tip { | |
background:#EEE; | |
position:absolute; | |
top:50%; | |
left:50%; | |
margin-top:-62.5px; | |
margin-left:-119px; | |
height:125px; | |
width:138px; | |
} |
This file contains hidden or 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
(function($) { | |
$.fn.descendantOf = function(parentId) { | |
return this.closest(parentId).length != 0; | |
} | |
})(jQuery) | |
/* | |
* USAGE | |
* $('#element').descendantOf('#another-element'); if #element is within #another-element then this will return true | |
* |
This file contains hidden or 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
/** | |
* Builds a horizontal masonry in whats possbily (i haven't researched | |
* the techniques) a crude manner. | |
* Fits elements into columns if there is room and sets the width of | |
* the container element to contain all the columns. | |
* | |
* Known Issues: | |
* - Does not do anything clever for elements where height exceeds | |
* window height (probably just gets chopped off if overflow: hidden) | |
* - All elements are expected to be the column width |
This file contains hidden or 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
(function( $ ){ | |
$.fn.isCurrentPage = function() { | |
if (window.location.href.indexOf(this.attr('href')) >= 0) { | |
return true; | |
} | |
else { | |
This file contains hidden or 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 myArray = ["Good!", "Great!", "Awesome!", "Super!", "Nice!"]; | |
function random(array) { | |
return array[Math.floor(Math.random() * array.length)]; | |
} | |
random(myArray); |
This file contains hidden or 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
(function ($) { | |
$.fn.verticalCenter = function () { | |
var obj = this; | |
obj.parent().css({ | |
'position': 'relative' | |
}); | |
obj.css({ | |
'margin-top': -this.outerHeight() / 2, | |
'margin-left': -this.outerWidth() / 2, | |
'position': 'absolute', |
This file contains hidden or 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
(function ($) { | |
$.fn.currentScrollPos = function () { | |
var obj = this.offset().top; | |
obj = obj - window.pageYOffset; | |
return obj; | |
} | |
})(jQuery); | |
$(window).scroll(function () { | |
console.log($('#your-element').currentScrollPos()); |
This file contains hidden or 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
// Requires jQuery easing | |
function moveLabels() { | |
// Get the original position values | |
var pos = $('#contact label').css('left').replace('px', ''); | |
$('input[type=text],textarea').focusin(function () { | |
var label = $(this).prev('label'); | |
label.stop(true, false).animate({ | |
'left': -label.width() - pos |
This file contains hidden or 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
<?php | |
function create_background($filename) { | |
// Get the file extension | |
$file_pieces = explode('.', $filename); | |
$file_name = $file_pieces[0]; | |
$file_ext = $file_pieces[1]; | |
$new_filename = $file_name.'_bg.'.$file_ext; |
This file contains hidden or 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
function removeWildcardClass(string, element) { | |
$(element).each(function () { | |
var aryClasses = $(this).attr('class').split(' '); | |
for (var i = 0; i < aryClasses.length; i++) { | |
if (aryClasses[i].indexOf(string) != -1) { | |
$(this).removeClass(aryClasses[i]); | |
} | |
} | |
}); |
OlderNewer