If you are going to do this in Modernizr, I would say do not try to write a trilateral condition; write three separate true / false conditions.
those. instead of having one condition that says “desktop”, “mobile” or “tablet”, you should have three conditions: “desktop”, “mobile” or “tablet”, each of which will be true or false .
Hope this answers your question.
However, another point I would raise is how you draw a line between these types?
It is easy to say that the iPhone is a mobile phone, and the iPad is a tablet, but between them there are devices of any size; where is the cut-off point when the mobile phone becomes a tablet? What about a tablet that can connect to the base unit to become a laptop?
The problem you are about to face is that the form factors are very fluid; therefore, you may never be completely sure of some devices as to which category they belong to. You might be better off setting your dynamic site to screen resolution using custom CSS and CSS queries.
Hope this helps.
source share