Skip to content

Instantly share code, notes, and snippets.

View bjankord's full-sized avatar
🎵
Chillin'

Brett Jankord bjankord

🎵
Chillin'
View GitHub Profile
@bjankord
bjankord / gist:4240280
Created December 8, 2012 13:28
JS IE Detection with conditional comments
var ieCheck = document.createElement('div');
ieCheck.innerHTML = '<!--[if lt IE 7]>IE6<![endif]--><!--[if IE 7]>IE7<![endif]--><!--[if IE 8]>IE8<![endif]--><!--[if IE 9]>IE9<![endif]-->';
if (ieCheck.innerHTML === 'IE6') {
alert('IE6 or lower');
} else if (ieCheck.innerHTML === 'IE7') {
alert('IE7');
} else if (ieCheck.innerHTML === 'IE8') {
alert('IE8');
@bjankord
bjankord / ie-conditiona-comments.css
Created December 8, 2012 13:39
IE conditional comments CSS
.foo {
color: black;
}
.lte-ie8 .foo {
color: green; /* IE8 and older */
*color: blue; /* IE7 and older */
_color: red; /* IE6 and older */
}
@bjankord
bjankord / gist:4245356
Created December 9, 2012 14:43 — forked from anonymous/gist:545079
Fix label click issue on iPad
//http://v4.thewatchmakerproject.com/blog/how-to-fix-the-broken-ipad-form-label-click-issue/
$(document).ready(function () {
if (navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/iPad/i)) {
$('label[for]').click(function () {
var el = $(this).attr('for');
if ($('#' + el + '[type=radio], #' + el + '[type=checkbox]').attr('selected', !$('#' + el).attr('selected'))) {
return;
} else {
$('#' + el)[0].focus();
@bjankord
bjankord / gist:4269268
Created December 12, 2012 16:28
Picture Element + URI Templates
<head>
<style type="text/css">
@media screen and (min-width:321px){
picture source {
content: attr({filename}-m.{ext}, url);
}
}
@media screen and (min-width:641px){
@bjankord
bjankord / gist:4314336
Created December 16, 2012 23:50
Custom UAs with JavaScript
navigator.__defineGetter__('userAgent', function(){
return 'foo' // customized user agent
});
alert(navigator.userAgent); // 'foo'
@bjankord
bjankord / ismobile.php
Created January 4, 2013 17:23
Simple mobile device detection
<?php
// Code coming soon
?>
<img class="img" src="http://placekitten.com/320/480" alt="" data-big="http://placekitten.com/1024/768" />
@bjankord
bjankord / gist:4476159
Created January 7, 2013 16:13
ASCII Art for 45° projects
*
* *
* *
* *
* 45° *
* *
* * * * * * *
A Fortyfifth Degree Project
@bjankord
bjankord / asterisk-font-stacks.css
Created February 21, 2013 17:07
Required form field asterisk font-stacks
/* Fonts based on CTC Aspire's post, A List of 36 Web Safe fonts: http://www.ctc-aspire.co.uk/blog-post-36-web-safe-fonts-157-34.html */
label em {
color: #f00;
font-family: "Franklin Gothic Medium", "Courier New", monospace;
}
label em {
color: #f00;
font-family: "Myriad Pro", Georgia, serif;
@bjankord
bjankord / gist:5188081
Created March 18, 2013 15:41
Enhanced JS checks
//Way to differieniate between enhanced and base versions from http://www.zachleat.com/toolordie/set2/slide4.html
// IE8+, BB 5+
"querySelectorAll" in document
// IE7+ (jQuery Mobile 1.0)
$.support.mediaquery || $.mobile.browser.ie && $.mobile.browser.ie >= 7;
// IE9+, BB 7+