Streaming live at 10am (PST)

Add existing subclass with JS for desktop only?

Hi folks!

How do I add an existing subclass with Javascript for desktop devices only?
I’m trying this and it doesn’t work.

<script>
if( /Android|webOS|iPhone|iPad|iPod|Opera Mini/i.test(navigator.userAgent) ) {
 // run your code here
}
else {
if (window.innerWidth > 991) {
    // window width is more than 991px
    $(".retreat-img").addClass("desktop");
}
}
</script>