I think the title is self-explanatory. I need a jQuery function to "enable" only when I am in a resolution less than 1024px.
I think the title is self-explanatory. I need a jQuery function to "enable" only when I am in a resolution less than 1024px.
You can detect the screen size and perform the function:
screen.width
and screen.height
respectively store the width and height of the screen.
if(screen.width < 1024){
//executa a funcao para ativar
}
Another way I found here using javascript is like this:
The function returns true
if the browser used is mobile and false
otherwise.
function isMobile() {
var userAgent = navigator.userAgent.toLowerCase();
if (userAgent.search(/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i) != -1) {
return true;
}
return false;
}