Created
January 18, 2013 12:45
-
-
Save TCotton/4564346 to your computer and use it in GitHub Desktop.
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
MOBILE = window.MOBILE || {}; | |
MOBILE.QUERIES = (function() { | |
'use strict'; | |
// declare document and windows in variables for performace | |
var doc = document, | |
win = window; | |
var _private = { | |
set: function(args) { | |
// use the HTML5 API matchMedia to target phones and tablets | |
var matches = win.matchMedia("(max-width: 1024px)").matches; | |
if (matches) { | |
this.run(); | |
} | |
}, | |
run: function() { | |
doc.body.onclick = this.event; | |
}, | |
event: function(event) { | |
// on clicking links run script | |
if (event.target.tagName.toLowerCase().toString() === 'a') { | |
var slider, x, l, animationOne, element; | |
// add blur class to the body tag | |
doc.body.classList.add('blur'); | |
setTimeout(function() { | |
// display ajax loading symbol | |
doc.getElementById('ajaxLoader').style.display = 'block'; | |
}, 100); | |
setTimeout(function() { | |
doc.getElementById('ajaxLoader').style.display = 'none'; | |
}, 5000); | |
} | |
} | |
}; | |
return { | |
init: function(args) { | |
if (typeof args.matchMedia !== 'undefined') { | |
_private.set(args); | |
} | |
} | |
}; | |
}()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment