Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

check if mobile view javascript

$(function() {      
    let isMobile = window.matchMedia("only screen and (max-width: 760px)").matches;

    if (isMobile) {
        //Conditional script here
    }
 });
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #mobile #view #javascript
ADD COMMENT
Topic
Name
7+2 =