1

I've got a function that resizes a viewer on resize. I am trying to disable this on mobile except I'm hitting a wall when In my If Statement. Below is my code.

  function desktopResizeOnly() {
                if(/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) {
                    alert('Mobile');
                } else {
                    $scope.$on('window:resize', function(event, bp) {
                        viewer.destroy();
                        update(bp);
                    });
                }
            }
Brendan
  • 331
  • 1
  • 3
  • 12
  • 1
    Is `window:resize` an event you're raising somewhere else in the application? Otherwise you're going to want to change the way you're listening for window resizes. [Here's a good start](http://stackoverflow.com/questions/21626357/angularjs-event-on-window-innerwidth-size-change) – Ankh Mar 13 '17 at 09:52
  • I'll read into this, thank you. – Brendan Mar 13 '17 at 10:25
  • Explain "hitting a wall when In my If Statement". – georgeawg Mar 13 '17 at 13:41

0 Answers0