Welcome to the in5 Answer Exchange! This a place to get answers about in5 (InDesign to HTML5) and make requests.
0 votes
Hi there.
I'm trying to make the document jump to a specific page when a scrollLeft event is triggered on another, specific, page (and, on the other side, to another page when a scrollRight event occurs).

I found out that 'jumping' could be done by using JQuery swipe event, like that:
$("#container").on("swipe", function(event){
        if(nav.current == 2){  //if current page is #2
            nav.to(5); //jump to page #5
        }
    });
This will make document jump to page #5 if a swipe (to left or to right) is triggered on page #2.

Instead, this code will not work (i.e.: swipe gesture just work as usual):
$("#container").on("swipeLeft", function(){
        if(nav.current == 2){  //if current page is #2
            nav.to(5); //jump to page #5
        }
    });

My guess: swipe binding navigation behavior overrides swipeLeft code. Could be?
Do you have any advice about how could I make document jump if a swipeLeft/swipeRight event occurs?
in how_to by (150 points)
  

1 Answer

0 votes
 
Best answer

in5 uses the touchSwipe library, which has syntax like the following for swipeLeft (and swipeRight):

$("#container").swipe({
  swipeLeft:function(event, direction, distance, duration, fingerCount) {
     alert('swipe left');
  }, 
  swipeRight:function(event, direction, distance, duration, fingerCount) {
     alert('swipe right');
  }
});

You'll also may need to remove the swiping that is already there.

See this answer on how to exlude individual pages from swiping:
https://ajarproductions.com/pages/products/in5/answers/3648/block-pages-from-swipe?show=3652#a3652

by (197k points)
selected by
Thanks justin! I'll try that.