Ramesh S

Ramesh S

  • NA
  • 319
  • 7.8k

which is best way detect mobile device javascript or media?

Dec 7 2015 12:22 AM
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)