let mediaQuery = window.matchMedia("(min-width: 768px)"); if (mediaQuery.matches) { // destop } else { // mobile }