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
// Hastily plonked together by @replete, [email protected] | |
/* Use like this: | |
<div class="some-html-chunk" data-sync-height="a-unique-name">Foo</div> | |
<div class="some-other-html-chunk" data-sync-height="a-unique-name">Bar</div> | |
*/ | |
$('[data-sync-height]') | |
.each(function(i,e){ |
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.autoGrowInput = function(o) { | |
o = $.extend({ | |
maxWidth: 1000, | |
minWidth: 0, | |
comfortZone: 70 | |
}, o); |
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 d = document, | |
b = d.getElementsByTagName("body"), | |
w = window, | |
c = "className", | |
v = (function() { return w.innerWidth || d.documentElement.clientWidth }), | |
r = function () { | |
i = v(); | |
if (i < 181) { b[0][c] = "max-180"; return } | |
if (i < 246) { b[0][c] = "max-245"; return } | |
else { b[0][c] = "" } |
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
//jQuery | |
if ( $(".some-element").filter(":focus").length >= -1 ) { | |
//$(".some-element") contains 1 item, and it is focussed | |
} | |
if($(".some-element")[0] == document.activeElement) { | |
//first element of object is selected | |
} |
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
//jQuery | |
$("#swapImg") | |
.attr("src", "dynamic-image-url.jpg") | |
.one("load",function(){ | |
//image has loaded | |
}) | |
.each(function(){ | |
if(this.complete) //trigger load if cached in certain browsers | |
$(this).trigger("load"); |
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
/* -------------------------------------- */ | |
//iOS-like scrollbar | |
var $niceScrollContainers = $("[data-ios-scroll]"); | |
$niceScrollContainers.each(function () { | |
var $container = $(this), | |
scrollClass = $container.attr("data-ios-scroll"), | |
cursorWidth = "6px", | |
$contentsLastChild = $container.children("*:last-child"); |
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
$.loadCss=function(css){$('head').append('<link rel="stylesheet" type="text/css" href="'+css+'">')}; |
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
a[href^="http://"] { | |
/* fully valid URL, likely external link */ | |
} | |
a[href="http://google.com"] { | |
/* link to specific website */ | |
} | |
a[href^="/"], a[href^=".."] { | |
/* internal relative link */ |
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
<ul id="slidecontrols"> | |
<li><a href="#one">One</li> | |
<li><a href="#two">Two</li> | |
</ul> | |
<div id="slides"> | |
<div>This is content block One</div> | |
<div>This is content block Two</div> | |
</div> |
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 showalltags() { | |
$tags = get_tags(); | |
$html; | |
foreach ($tags as $tag){ | |
$tag_link = get_tag_link($tag->term_id); | |
$html .= "<a href='{$tag_link}' title='{$tag->name} Tag' class='{$tag->slug}'>"; |