Skip to content

Instantly share code, notes, and snippets.

View etch-snippets's full-sized avatar

etch-snippets

View GitHub Profile
@etch-snippets
etch-snippets / iframe-mousemove.js
Created October 25, 2012 11:35
[jQuery] Track mouse movement in an iframe
$('iframe').contents().mousemove( function(e) {
console.log( e.clientX, e.clientY );
});
@etch-snippets
etch-snippets / fullheight.js
Created October 25, 2012 15:41
[jQuery] Set any element to the height of the window.
$.fn.fullHeight = function( offset ){
// Check if offset specified
if (offset === '') {
// If it's not then set it to 0
offset = 0;
}
// Maintain chainability
@etch-snippets
etch-snippets / descendantOf.js
Created October 25, 2012 15:43
[jQuery] Is an element descended from another
(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
*