malihu / malihu-custom-scrollbar-plugin

Highly customizable custom scrollbar jQuery plugin, featuring vertical/horizontal scrollbars, scrolling momentum, mouse-wheel, keyboard and touch support etc.
http://manos.malihu.gr/jquery-custom-content-scroller
MIT License
4.11k stars 1.5k forks source link

custom scrollbar with touchswipe.js library (Right, Left) #324

Open romanlex opened 9 years ago

romanlex commented 9 years ago

Touchswipe jQuery not work with mcustomscrollbar :( If i swipe on div#filter .fixed - sidebar is closed, but if i swipe on mcustomscrollbar area - swipe not work( My html:

<div id="sidebar" class="col-25 nopad-rl">
            <div id="filter">
                <div id="filter-wrapper">
                    <div class="fixed">
                        <h2><button class="closeFilter"></button>Filters<span class="filter-ajax-icon"><img src="img/ajax-filter-mob.gif"></span></h2>
                        <div class="filter-buttons">
                            <button class="button blue" id="submitfilter">Submit</button>
                            <button class="button grey" id="restorefilter">Reset</button>
                        </div>
                    </div>
                    <ul class="menu">
                            ....
                    </ul>
                </div>

            </div>
        </div>
    </div>

my app.js:

$('#filter ul.menu').mCustomScrollbar({
        theme:"light",
        mouseWheel:{ enable: true },
        scrollInertia: 400,
        contentTouchScroll: 25
    });
if(isMobile) {
        $('body').swipe( {
            swipeLeft:function(event, direction, distance, duration, fingerCount) {
                console.log('TouchSwipe Left');
                $('#sidebar').addClass('mobOpened');
            },
        });
        $('#filter').swipe({
            swipeRight:function(event, direction, distance, duration, fingerCount) {
                console.log('TouchSwipe Right');
                $('#sidebar').removeClass('mobOpened');
            }
        });
    }
georgi-aba commented 8 years ago

I have the same problem. I’ve tied with the “touchswipe.js” library and with the “jquery.event.swipe.js” but still no result. If I apply the swipe to an element outside the .mCustomScrollbar it works, But if it’s on the .mCustomScrollbar or inside it does not.