How to resize a view when the parent div is resized?

Last Updated: Release 4.3

Issue/Question

In an HTML5 client, what steps are needed to ensure that a view gets resized whenever the parent div is resized?

Solution

Create an event on the parent div that gets triggered when the div resizes. When the event fires, resize the view using one of the following methods (which can be found in the View class):

  • resize: use this method to auto-resize the view.
  • setSize: use this method to set the view to a particular size.

See the API reference for more information.

In both cases, the contents of the resized view, whether scaled or cropped, are determined by the service's implementation.

 

April 11, 2017