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);
                    });
                }
            }
3
  • 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 Commented Mar 13, 2017 at 9:52
  • I'll read into this, thank you. Commented Mar 13, 2017 at 10:25
  • Explain "hitting a wall when In my If Statement". Commented Mar 13, 2017 at 13:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.