Created
May 29, 2012 15:32
-
-
Save timiles/2829104 to your computer and use it in GitHub Desktop.
nice js snippets
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
/*-- to detect mobile size in js --*/ | |
/* credit: http://bricss.net/post/22198838298/easily-checking-in-javascript-if-a-css-media-query-has */ | |
function isMobileSize() { | |
var size = window.getComputedStyle(document.body, ':after').getPropertyValue('content'); | |
return size.indexOf('mobile') != -1; | |
} | |
/* | |
@media (max-width: 767px) | |
{ | |
body:after | |
{ | |
content: 'mobile'; | |
display: none; | |
} | |
} | |
*/ | |
/*-- rel=autoPostBack on select boxes using jQuery --*/ | |
$('FORM SELECT[rel*=autoPostBack]').change(function () { | |
$(this).parents('form').submit(); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment