needim / wdt-emoji-bundle

Slack like emoji picker with apple/ios, twitter/twemoji, google, emojione, facebook, messenger emoji support
http://ned.im/wdt-emoji-bundle
MIT License
419 stars 87 forks source link

Scroll #4

Closed felipemechailech closed 7 years ago

felipemechailech commented 8 years ago

Hi Guys, Congrats for the project, it's awesome! I suggest implement this plugin to fix the popup scrolling, It'll prevent the page scroll together:

$.fn.isolatedScroll = function() {
    this.bind('mousewheel DOMMouseScroll', function (e) {
        var delta = e.wheelDelta || (e.originalEvent && e.originalEvent.wheelDelta) || -e.detail,
            bottomOverflow = this.scrollTop + $(this).outerHeight() - this.scrollHeight >= 0,
            topOverflow = this.scrollTop <= 0;
        if ((delta < 0 && bottomOverflow) || (delta > 0 && topOverflow)) {
            e.preventDefault();
        }
    });
    return this;
};

So just need to put: $('.wdt-emoji-scroll-wrapper').isolatedScroll()

needim commented 8 years ago

Hi Felipe, Thanks for the snippet!