code: function startRepositioningOnResize() {
  
          var repositionMenu = (function(target, options) {
            return $$rAF.throttle(function() {
              if (opts.isRemoved) return;
              var position = calculateMenuPosition(target, options);
  
              target.css(animator.toCss(position));
            });
          })(element, opts);
  
          $window.addEventListener('resize', repositionMenu);
          $window.addEventListener('orientationchange', repositionMenu);
  
          return function stopRepositioningOnResize() {
  
            // Disable resizing handlers
            $window.removeEventListener('resize', repositionMenu);
            $window.removeEventListener('orientationchange', repositionMenu);
  
          };
        }
docs: Configure various resize listeners for screen changes