Notice: The Monaca & Onsen UI Community Forum is shutting down.

For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.

Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.

how to reduce tab swipe sensitive when scrolling



  • when i scrolling a tab page, it always trigger swipe.
    can anyone tell me how to reduce tab swipe sensitive when scrolling?
    sorry about my poor english, i really need to fix this problem, thanks.


  • Onsen UI

    @chang the “auto scroll ratio” is based on screen size and swipe velocity, meaning that if you move your finger fast it is more likely that the swipe will take effect than if you move it slowly. There is not public API to modify this but you can always override the behavior by adding some custom code. You can modify myTabbar._getAutoScrollRatio property and add a function that returns a decimal value between 0 and 1. If you return, for example, 0.8, it means you need to swipe at least 80% of the view to change the page. The original code is here.



  • hi Fran Diox

    i just fix this problem by using jquery.touchSwipe lib,
    i disabled the tab swipe, and use jquery.touchSwipe to trigger like this…

        $(page).swipe({
            swipe: function (event, direction, distance, duration, fingerCount) {
                    if (direction === 'right' && tabbar.getActiveTabIndex() > 0) {
                        tabbar.setActiveTab(tabbar.getActiveTabIndex() - 1);
                    }
                    else if (direction === 'left' && tabbar.getActiveTabIndex() < 4) {
                        tabbar.setActiveTab(tabbar.getActiveTabIndex() + 1);
                    }
            },
            allowPageScroll: 'vertical'
        });
    

    i will try your way later,
    thank you. :smiley: