Return to Snippet

Revision: 51209
at September 17, 2011 00:29 by kendsnyder


Initial Code
$.fn.setOuterWidth = function(px) {
	var width = px - 
		parseFloat(this.css('padding-left')) - 
		parseFloat(this.css('padding-right')) -
		parseFloat(this.css('border-left-width')) -
		parseFloat(this.css('border-right-width'))
	return this.css('width', width + 'px')		
}
$.fn.getOffsetRight = function() {
	return Math.round(this.outerWidth() + this.offset().left)
}
$.fn.getOffsetBottom = function() {
	return Math.round(this.outerHeight() + this.offset().top)
}
$.fn.isChildOf = function(node) {
	if (node instanceof $) {
		node = node[0]
	}
	if (!node) {
		return false
	}
	var child, i
	for (i = 0; i < this.length; i++) {
		child = this[i]
		do {
			child = child.parentNode
			if (child == node) {
				return true
			}
		}
		while (child)
	}
	return false
}

Initial URL


Initial Description


Initial Title
jQuery sizing tools

Initial Tags
plugin, jquery

Initial Language
jQuery