Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for scrolling by dragging #240

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

takashi
Copy link

@takashi takashi commented Jun 24, 2013

this closes #4
add support for scrolling by dragging.
I added event when the element which is dragged and the event only gets fired when the element is out of the scroll pane.

@dataweb
Copy link

dataweb commented Aug 25, 2013

Thank you for this code. I have been fighting this issue for some time. I'm using JQuery UI (sortable) along with the jscrollpane and the struggle I'm having now is that when I drag an item, once it starts scrolling the helper (dragging item) simply scrolls with the other content and away from the mouse. Is there any way around this? Has anyone else experienced this issue?

@dataweb
Copy link

dataweb commented Aug 25, 2013

Omgosh! I think I just solved it. I found an old archived version of a discussion that Kelvin had with another user waayy back in 2009 about using jquery sortable with jscrollpane (the helper moving away from the mouse while scrolling). Now, while we're on new versions of both components, this code still ended up solving my issue:

// We need to do it differently so it works in jScrollPane...
$('#sort2').sortable(
{
appendTo: 'body',
helper: 'clone'
}
);
$('.scrollpane')
.jScrollPane().
bind(
'scroll',
function(e)
{
$('.sortinate', this).sortable('refreshPositions');
}
);

Basically, we're just telling jquery sortable to clone the helper and also append to the body instead of the list and then tell jscrollpane that while it's scrolling to "refreshPositions" on the sortable component...and boom!! It works! Omgosh, I have been fighting this for hours and hours and hours...needing it for multiple components. THANK YOU KELVIN, and thank you Tak0303 (I'm using your dragging code as well in jscrollpane), and definitely should mention that web.archive.org was a lifesaver since the original example was taken down. :P

Figured I'd post the answer I discovered here so others might not spend so long searching!!! >.<

@vitch
Copy link
Owner

vitch commented Sep 13, 2013

Thanks for the pull request @tak0303 and sorry for the very slow reply.

I've just tried to integrate the PR but unfortunately it doesn't work with horizontal scrollbars (the old plugin didn't support horizontal scrollbars so it wasn't necessary there). Would you be able to update the PR with support for situations with horizontal scrollbars?

Thanks!

@takashi
Copy link
Author

takashi commented Sep 13, 2013

@vitch thanks for replying, and i'll fix it and update PR soon :)

@takashi
Copy link
Author

takashi commented Oct 16, 2013

@vitch sorry, I can't add horizontal scroll with dragging feature at once.
So, can you merge this branch atm? and I'll try to add the feature after that.
Thanks!

@sonlamhuynh
Copy link

@takashi, How you make 'horizontal scroll with dragging feature'? Can you help me?

@illuusio
Copy link
Collaborator

illuusio commented Dec 7, 2017

@takashi this is still working with version 1.x and do you have time to update this to work with jQuery 3 as there is bind and unbind used which are jQuery below 1.7 stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for scrolling by dragging over the text within the scrollpane
5 participants