jquery.kinetic icon indicating copy to clipboard operation
jquery.kinetic copied to clipboard

Sudden stop after mouseup

Open freyhubert opened this issue 8 years ago • 6 comments

Firstly, thanks for this great plugin. I'm facing an issue while using filterTrigger method. There is no deceleration after mouseup, scroll stops immediatelly. If I comment this method out, everything works fine, except preventing child elements events (of course). ul.kinetic({ filterTarget: function(target, e){ if (!/down|start/.test(e.type)){ return !(/area|a|input/i.test(target.tagName)); } } });

freyhubert avatar Mar 14 '16 17:03 freyhubert

@freyhubert I can not find the code you mention above. Could you show more info about it? Ex: filename, line...etc

tsaikd avatar Mar 16 '16 08:03 tsaikd

@tsaikd Hi, this code is mentioned under Filtering Clickable elements here: https://github.com/davetayls/jquery.kinetic If I comment filterTarget out, everything works fine with smooth deceleration.

Mac OSX 10.10.5 Yosemite, Firefox 44.0.2

freyhubert avatar Mar 16 '16 09:03 freyhubert

It's just an example code in README.

filterTarget is a option for customizing the behavior of kinetic. If you don't need to filter mouse event on element, just ignore filterTarget option. kinetic support many options. You just pick up options to fit your need.

tsaikd avatar Mar 16 '16 09:03 tsaikd

@tsaikd Of course, but I need to filter mouse event. I'm using Kinetic above product table so I need to have the ability to click on child elements inside wrapper.

freyhubert avatar Mar 16 '16 09:03 freyhubert

@freyhubert I think you should find the correct way to filter the element in filterTarget option. For example:

<div id="wrapper">
    <div class="kinetic-enable-this-element">foo</div>
    <div class="kinetic-disable-this-element">bar</div>
</div>
$('#wrapper').kinetic({
    filterTarget: function(target, e){
        return $(target).hasClass("kinetic-enable-this-element");
    }
});

tsaikd avatar Mar 16 '16 09:03 tsaikd

@tsaikd Thank you, this solved the problem filterTarget: function(target, e){ return !$(target).is('a, i, area, button, input'); }

freyhubert avatar Mar 16 '16 10:03 freyhubert