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
// Force hasLayout: wait til after page load, toggle zoom moments later | |
$.fn.hasLayout = function(){ | |
var | |
$el = $(this), | |
zoom = function(){ | |
$el.css('zoom','0').css('zoom','1'); | |
}, | |
delay = function(x){ | |
setTimeout(x,100); | |
}; |
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
<style> | |
.aspectWrapper { | |
position: relative; | |
} | |
.aspectImg { | |
display: block; | |
height: auto; | |
position: relative; | |
width: 100%; |
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
/* | |
Return $ function limited to current context. | |
e.g | |
if: | |
var $widget = $('widget').scope() | |
then: | |
$widget() == $('widget') | |
$widget('a') == $('widget').find('a') |
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
/* | |
Wait for all elements with external resources (imgs, iframes) | |
in current $ scope to have loaded before firing passed event. | |
e.g. | |
$('.plugin img').loadAll(function(){...}) | |
For a version of $().load that forces a reload (if load has already | |
fired before event binding), use |
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
@media(-webkit-min-device-pixel-ratio:1.1){ | |
/* Media query restricts to mobile: avoid Chrome purple scroll bars */ | |
[style] { | |
-webkit-transform: translateZ(0); | |
} | |
} |
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
/* | |
$(el).data() is fine if you're using it for simple key/value pairs, but if there's any depth (objects), adding to or modifying said objects becomes a verbose pain in the ass. | |
This extension method uses $.extend() to add or modify any object with the given key: | |
$(el).data('plugin',$.extend($(el).data('plugin'),{state:1})) | |
...becomes: | |
$(el).dataExtend('plugin',{state:1}) |
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
/* | |
In IE, Sizzle has to create custom attributes to be able to travel the DOM intelligently. The custom attributes are lengthy and nasty, and can often screw up your code if you rely on parsing markup. fizzleSizzle wipes all that stuff out. | |
*/ | |
// Pass in a string of markup and get it back without Sizzle's shizzle | |
var fizzleShizzle = function(x){ | |
return x.replace(/(nodeIndex|sizcache|sizset)[\w\d]*(="[^"]*")*/gi,''); | |
}; | |
(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
if(!window.console) console = {log: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
browser = { | |
ieVersion: function () { | |
var undef; | |
var v = 3; | |
var div = document.createElement('div'); | |
var all = div.getElementsByTagName('i'); | |
while ( | |
div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->', all[0]); | |
return v > 4 ? v : undef; | |
}, |
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
.line, | |
.line > :nth-child(n+2):last-child{ | |
overflow: hidden; | |
} | |
.line > *{ | |
float:left; | |
} | |
.line > :nth-child(1):nth-last-child(2){ | |
width:50%; | |
} |