2
Answers

which is best way detect mobile device javascript or media?

Ramesh S

Ramesh S

8y
420
1
which is best way detect mobile device javascript or media query? 
     javascript       
              $(document).ready(function () {
                     alert(detectmob());
               });
function detectmob() {
               if (window.innerWidth <= 800 && window.innerHeight <= 600) {
                              return false;
                 } else {
                           $(".blackbutton").addClass("ismobileblockbutton");
                           $('.ismobileblockbutton').removeAttr("href")
                        }
                  }
 
media query
@media screen and (min-width:600px) and (max-width: 800px) {
.tbms {
height: 60px !important;
}
}
 
 
 
 
 
Answers (2)