SOURCE CODE: Zoom and Pan

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
  <title>Zoom and Pan | JavaScript Examples | UIZE JavaScript Framework</title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  <meta name="keywords" content="widget zoom Uize.Widget.ImagePort.Draggable"/>
  <meta name="description" content="See how a draggable image port lets you control zoom for an image in a view port by ctrl-clicking and dragging, or pan by just clicking and dragging."/>
  <link rel="alternate" type="application/rss+xml" title="UIZE JavaScript Framework - Latest News" href=""/>
  <link rel="stylesheet" href="../css/page.css"/>
  <link rel="stylesheet" href="../css/page.example.css"/>


<script type="text/javascript" src="../js/Uize.js"></script>

<h1 class="header">
  <a id="page-homeLink" href="../index.html" title="UIZE JavaScript Framework home"></a>
  <a href="../index.html" class="homeLinkText" title="UIZE JavaScript Framework home">UIZE JavaScript Framework</a>

<div class="main">
  <h1 class="document-title">
    <a href="../javascript-examples.html" class="breadcrumb breadcrumbWithArrow">JAVASCRIPT EXAMPLES</a>
    Zoom and Pan
    <div class="pageActionsShell">
      <div id="page-actions" class="pageActions"><a href="source-code/image-port-zoom-and-pan.html" class="buttonLink">SOURCE</a></div>

  <!-- explanation copy -->

  <div class="explanation">
    <p>In this example, an instance of the <a href="../reference/Uize.Widget.ImagePort.Draggable.html"><code>Uize.Widget.ImagePort.Draggable</code></a> class is created to display a large image inside a small image port and then to allow the user to zoom and pan the image inside the port using the mouse. To pan, simply click-and-drag inside the image port. The change zoom level, use the ctrl modifier key: ctrl-drag-up zooms in, and ctrl-drag-down zooms out.</p>

  <div id="page_imagePort" style="position:relative; width:700px; height:380px; overflow:hidden; background:#000; margin:auto; border:1px solid #555;">
    <img id="page_imagePort-image" src="" style="width:2700px; height:2700px; position:absolute;" alt=""/>

<!-- JavaScript code to activate the image port functionality -->

<script type="text/javascript">

Uize.require (
  function () {
    'use strict';

    /*** create the example page widget ***/
      var page = = UizeSite.Page.Example ();

    /*** add the draggable image port child widget ***/
      page.addChild (

    /*** wire up the page widget ***/
      page.wireUi ();