Giter VIP home page Giter VIP logo

Comments (1)

waynegm avatar waynegm commented on August 17, 2024

That should be possible by defining custom onUpdate callbacks - something like below:

var $img1 = $('#image1');
var $img2 = $('#image2');
$img1.imgViewer({
    onUpdate: function() {
          var zoom2 = $img2.imgViewer("option",zoom);
          if (zoom2 !==  this.options.zoom)
                 $img2.imgViewer("option",zoom, this.options.zoom);
          var view2 = $img2.imgViewer(getView);
          var view = this.getView();
          if (view2.left !== view.left || view2.right !== view.right || view2.top !== view.top || view2.bottom !== view.bottom  ) 
                 $img2.imgViewer("panTo",(view.left+view.right)/2, (view.top+view.bottom)/2));
    }
});
$img2.imgViewer({
    onUpdate: function() {
          var zoom1 = $img1.imgViewer("option",zoom);
          if (zoom1 !==  this.options.zoom)
                $img1.imgViewer("option",zoom, this.options.zoom);
          var view1 = $img1.imgViewer(getView);
          var view = this.getView();
          if (view1.left !== view.left || view1.right !== view.right || view1.top !== view.top || view1.bottom !== view.bottom  ) 
                $img1.imgViewer("panTo",(view.left+view.right)/2, (view.top+view.bottom)/2));
    }
});

from imgviewer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.