You might want to consider using , since its native Javascript code and also has good browser support:
- window.matchMedia("(min-width: 560px)").matches
Also what if the device is a Touch/Mobile device , what if its a larger ipad , you're hover will no longer work , or when the user clicks , the anchor tag the page will reload , you might want to consider userAgent detection , to see if the device is really a mobile...
UserAgent detection is generelly fragile code but it fits the use case since feature detection(usually the better alternative) ... throws false positives.