3
I think the title is self-explanatory. I need a particular function in jQuery to "activate" only when I’m at a resolution less than 1024px.
3
I think the title is self-explanatory. I need a particular function in jQuery to "activate" only when I’m at a resolution less than 1024px.
7
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 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;
}
It was just that. It didn’t come to my mind at the time. Thank you.
Browser other questions tagged javascript jquery
You are not signed in. Login or sign up in order to post.
would be like a media queries only with jquery?
– haykou