Link to home
Start Free TrialLog in
Avatar of coolispaul
coolispaulFlag for United States of America

asked on

jQuery PanZoom

Hi

Does anyone know if you can use buttons for the panzoom panning instead of dragging on this:
https://github.com/timmywil/jquery.panzoom

Thanks
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

yes u can, here the html i used that worked for me with the buttons.
the only file i used is jquery.panzoom.min.js in the same folder of the html.

<!doctype html>
<html>
  <head>
    <title>Panzoom for jQuery</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <style type="text/css">
      section { text-align: center; margin: 50px 0; }
    </style>
  </head>
  <body>
	<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
	<script src="jquery.panzoom.min.js"></script>
    <section>
      <h1>Panning and zooming with CSS3</h1>
      <div id="panzoom" style="text-align: center">
        <img src="http://blog.millermedeiros.com/wp-content/uploads/2010/04/awesome_tiger.svg" width="900" height="900">
      </div>
    </section>
    <section class="buttons">
      <button class="zoom-in">Zoom In</button>
      <button class="zoom-out">Zoom Out</button>
      <input type="range" class="zoom-range">
      <button class="reset">Reset</button>
    </section>
    <script>
      $("#panzoom").panzoom({
        $zoomIn: $(".zoom-in"),
        $zoomOut: $(".zoom-out"),
        $zoomRange: $(".zoom-range"),
        $reset: $(".reset")
      });
    </script>
  </body>
</html>

Open in new window

Avatar of coolispaul

ASKER

Hi sedgwick

Where are the left/right/up/down buttons?

Thanks
u didn't say anything about left/right/up/down buttons.
yeah i meant buttons for panning not zooming

I want to create left/right up /down buttons instead of the dragging...

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ok thnaks that works nicely,

there seems to be some delay but i can fiddle with this

Thanks
This is now officially supported!

In response to this request, the author of this jquery.panzoom created official support for this:

https://github.com/timmywil/jquery.panzoom/commit/6a735238f98f7cc3283f07d14a3b0eb56bf7b4bb
jq.panzoom.js
Here is a working example using the latest official code:

http://jsfiddle.net/timmywil/Khvrj/2/
Great thanks