3 Replies Latest reply on Dec 7, 2015 7:15 AM by AnatoleBeams

    JavaScript issue in iOS with window.Scroll & window.ScrollTo

    AnatoleBeams

      I have a database that plots items on a map by feeding JavaScript code into a WebViewer. It all works nicely in FileMaker Pro and also on WebDirect. When you conduct a search for a specific item, the system highlights the item on the map and scrolls the map (which is larger than the webviewer) to centre it. This last step works using the window.scrollto function in JavaScript but it fails to work on any iOS device over WebDirect. I understand from my searches on the internet that it is a common problem, but the simple fixes they suggest don't seem to have any effect (using setTimeout).

      This javascript function works perfectly on Mac and PC platforms, but it stubbornly refuse to scroll on any iOS device.

      function scrollWin(ctx) {

      window.scrollto((XSobject * " & Map_zoom_x & ") - " & Xwindow/2 & ", (YSobject * " & Map_zoom_y & ") - " & Ywindow/2 & ");

      }

      or this version using setTimeout:

      function scrollWin(ctx) {

      window.setTimeout( function() {window.scroll((XSobject * " & Map_zoom_x & ") - " & Xwindow/2 & ", (YSobject * " & Map_zoom_y & ") - " & Ywindow/2 & ");}

      , 10);

      }

      Does anyone have any ideas how I might be able to get this function to work on iOS devices too? The rest of the scripting plots a map and this final step should scroll the window to the location on the map, so it is pretty essential. However, any iOS device ignores it and shows the map at the origin.

      I have tried embedding it in a setTimeout but that doesn't help either. window.scroll does the same thing.

      I do understand that this is more a JavaScript issue and I am also investigating this through a JavaScript forum, but I thought it would be valid here too. I will cross-post any answers I get from either forums.

      Many thanks for any pointers anyone might have with this. Anatole