davetayls/jquery.kinetic

Help with target filtering

Closed this issue · 3 comments

Hello, i think that this plugin is quite amazing, but i have a small problem where i need to filter the target i want to scroll and i don't quite understand how to write it in the filterTarget method.

I want to be able to drag only ONE div with a particular id inside the wrapper, not all contents.

You could just return true/false depending on whether the target has that id. I think this would work

$('#wrapper').kinetic({
    filterTarget: function(target, e){
      return target.id === 'dragger';
    }
});

Thank you! Got it working now.

But i have another problem now. This is can be moved another way(by a slider of sort), but setting the 'left' value. Suppose i moved it to some point. Like left: '-300px'. How do i start kinetic movement from that point? No matter how i try(i tried setting the settings.scrollLeft to 300 or -300), but kinetic always starts movement from it's previous point that it remembered. Is there any way to set it to start from where i want to start?

not sure off the top of my head but try either setting the scroll position on the wrapper before you initialize .kinetic()