Skip to content

Instantly share code, notes, and snippets.

@staaky
Last active June 11, 2020 18:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save staaky/11034178 to your computer and use it in GitHub Desktop.
Save staaky/11034178 to your computer and use it in GitHub Desktop.
/*!
* Disable Fresco on Mobile Browsers
* http://www.frescojs.com
*/
(function($) {
var SUPPORTS_TOUCH = (function() {
try {
return !!(('ontouchstart' in window) ||
window.DocumentTouch && document instanceof DocumentTouch);
} catch (e) {
return false;
}
})();
// don't use this on non-touch devices
if (!SUPPORTS_TOUCH) return;
var viewport = (function() {
// Mobile Safari
if (!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)) {
return function() {
return {
width: window.innerWidth,
height: window.innerHeight
};
};
} else {
// everything else
return function() {
return {
width: $(window).width(),
height: $(window).height()
};
};
}
})();
$(document).ready(function() {
$(window).bind('resize orientationchange', function() {
var vp = viewport(),
disable = false;
if ((vp.width <= 568 && vp.height <= 320) ||
(vp.width <= 320 && vp.height <= 568)) {
disable = true;
}
Fresco[disable ? 'disable' : 'enable']();
})();
});
})(jQuery);
@oxwebdevelopment
Copy link

oxwebdevelopment commented Jun 10, 2020

Doesn't appear to work with Fresco 2.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment