Skip to content

Instantly share code, notes, and snippets.

@timiles
Created May 29, 2012 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timiles/2829104 to your computer and use it in GitHub Desktop.
Save timiles/2829104 to your computer and use it in GitHub Desktop.
nice js snippets
/*-- 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