Atalasoft
Welcome to Atalasoft Community Sign in | Join | Help
in

Sync Scrolling

Last post 27 Sep 2007, 4:04 PM by David Cilley. 1 replies.
Sort Posts: Previous Next
  •  27 Sep 2007, 3:25 PM 12603

    Sync Scrolling

    I am trying syncronize the scrolling of two Annotation Viewers from the client side of javascript. I was wondering how to get the ScrollPoistion of the WebImageViewControl and set the same position to another WebViewerControl.

     

    Thanks

    Colin

  •  27 Sep 2007, 4:04 PM 12604 in reply to 12603

    Re: Sync Scrolling

    As long as both of your viewers are the same size, the images that they contain are the same size, and both controls are at the same zoom level, the code below will work:

    <cc1:WebImageViewer ID="WebImageViewer1" runat="server" Height="400px" Width="300px" />
    <cc1:WebImageViewer ID="WebImageViewer2" runat="server" Height="400px" Width="300px" />
       
    <script language="javascript" type="text/javascript">
       atalaInitClientScript('OnPageLoad();');
       function OnPageLoad(){
          WebImageViewer1.ScrollPositionChanged = Viewer1Changed;
          WebImageViewer2.ScrollPositionChanged = Viewer2Changed;
       }
      
       function Viewer1Changed(){
          WebImageViewer2.setScrollPosition(WebImageViewer1.getScrollPosition());
       }

       function Viewer2Changed(){
          WebImageViewer1.setScrollPosition(WebImageViewer2.getScrollPosition());
       }
    </script>


    David Cilley
    My AJAX Imaging Blog
    Atalasoft Development Team
    Filed under: ,
View as RSS news feed in XML