msZoomTo method
Scrolls and/or zooms an element to its specified coordinate with animation.
Syntax
Element.msZoomTo(args);
Parameters
args [in]
Type: MSZoomToOptionsValue Meaning contentX Integer. The x-coordinate of the content that is the target of the scroll/zoom.
If no value is specified, defaults to the current centerpoint of visible content, horizontally.
contentY Integer. The y-coordinate of the content that is the target of the scroll/zoom.
If no value is specified, defaults to the current centerpoint of visible content, vertically.
viewportX The alignment point of the viewport. The scroll/zoom operation attempts to align this point with the contentX point.
- left
Aligns the left-most point of the viewport to the element's contentX value.
- center
Default. Aligns the horizontal center of the viewport to the element's contentX value.
- right
Aligns the right-most point of the viewport to the element's contentX value.
- Integer
Aligns the specified x-coordinate of the viewport to the element's contentX value.
viewportY The alignment point of the viewport. The scroll/zoom operation attempts to align this point with the contentY point.
- top
Aligns the top-most point of the viewport to the element's contentY value.
- middle
Default. Aligns the vertical center of the viewport to the element's contentY value.
- bottom
Aligns the bottom-most point of the viewport to the element's contentY value.
- Integer
Aligns the specified y-coordinate of the viewport to the element's contentY value.
scaleFactor Floating-point. The scale factor (msContentZoomFactor) to zoom to.
If no value is specified, defaults to the current zoom level (no additional zoom occurs).
This argument is ignored if the element is not zoomable.
animate The type of animation to use.
- default
Default. Uses the default animation.
- none
No animation is used.
Return value
This method does not return a value.
Remarks
This method has no scrolling effect on non-scrollable elements and no zooming effect on non-zoomable elements (e.g., elements with "-ms-content-zooming: none").
This method has no effect if called from a parent document to scroll or zoom content hosted in an iframe.
Examples
/* Zooming in on an element while still keeping it centered in the viewport */
var args = {
contentX: target.offsetLeft + target.offsetWidth/2;
contentY: target.offsetTop + target.offsetHeight/2;
scaleFactor: 2.0;
}
zoomer.msZoomTo(args);
See also
Windows apps using JavaScript Samples: HTML scrolling, panning and zooming sample
CSS properties for zooming and panning with touch
Internet Explorer Samples: Scrolling, panning, and zooming with touch input