Skip to content

Instantly share code, notes, and snippets.

View EnzoEmb's full-sized avatar

Enzo EnzoEmb

View GitHub Profile
(function($){
$.fn.outside = function(ename, cb){
return this.each(function(){
var $this = $(this),
self = this;
$(document.body).bind(ename, function tempo(e){
if(e.target !== self && !$.contains(self, e.target)){
cb.apply(self, [e]);
if(!self.parentNode) $(document.body).unbind(ename, tempo);
}
@EnzoEmb
EnzoEmb / landscape.txt
Last active April 10, 2019 13:07
Always Landscape CSS
/*
** Only use in case of hardcode
** We use max-aspect-ratio and not orientation: portrait because when an input get focused, the mq its disabled
** The site content needs to be wrapped in main-wrapper and main-wrapper--content
** The JS is to fix the weird vh behaviour in Chrome Android
*/
/* CSS */
/* @media screen and (min-aspect-ratio: 13/9){ } // landscape */
/* @media screen and (max-aspect-ratio: 13/9){ } // portrait */