search

Home  >  Q&A  >  body text

javascript - How to achieve sliding switching on the mobile page, so that it can slide from 1 to 2 but cannot slide back from 2 to 1?

The first page is the guide page and the second page is the home page. Swipe up on the first page on the mobile phone to display the second page (home page). After entering the home page, you cannot slide back to the first page. Tried swipe but it didn't solve the problem? May I ask how to solve it?

为情所困为情所困2744 days ago525

reply all(2)I'll reply

  • 我想大声告诉你

    我想大声告诉你2017-05-16 13:46:42

    There are many ways, such as hiding or deleting the number one after sliding it from one to two.

    Essentially, it is to prevent the process of sliding back from two to one.

    reply
    0
  • PHP中文网

    PHP中文网2017-05-16 13:46:42

    The library that encapsulates the complete pair should be able to set up hooks for you. Take a look at the documentation and see if there are any methods like
    beforeSwipe or shouldSwipe
    The simplest is to set a variable and set it to false after triggering;
    var swipable = true;
    function swipe(e) {

    if ( !swipable ) return e.preventDefault();
    swipable = false;

    }

    reply
    0
  • Cancelreply