magento 2 jquery check if is mobile view code example
Example: best way to detect mobile device jquery
$(function() {
let isMobile = window.matchMedia("only screen and (max-width: 760px)").matches;
if (isMobile) {
//Conditional script here
}
});