English 中文(简体)
j Query Sortable在拖拉时获得 cur子坐标
原标题:jQuery Sortable get cursor coordinates while dragging

能否在 with忙的Sortable时找到 cur子?

我有一个可滚动的支流体,有准确的间隔。 当用户把一个靠近滚动干线的元素拖到顶端,或者如果接近顶端,那么我就将再把80皮克。

$(allIds).sortable({
    connectWith: ".allLists",
    zIndex: 2,
    cursorAt: function(e) {
        if(e.top < 80) {
            myScrollFunction( up );
        }
        if(e.top > 500) {
            myScrollFunction( down );
        }
    }
}).disableSelection();

以上法典希望能给你一个我想要实现的想法。 我想要达到什么目标,是否会与已建的无理发展功能发生冲突?

<>光线> 我认为治疗器 是错误的选择。 我需要一种行动选择,来增加一项职能。 或类似......

$(allIds).sortable({
    connectWith: ".allLists",
    zIndex: 2
}, function(e) {
    if(e.position().top < 80) {
        myScrollFunction( up );
    }
    if(e.position().top > 500) {
        myScrollFunction( down );
    }
}).disableSelection();

但是,如果做这项工作,则大概只能发射<>>><>>>> > <> > > > > 可分类的活动是无用的。

最佳回答

为了回答我自己的问题,我是如何这样做的。

创立一个运动会,就可移动的散射区与可区分的职能分开举办

In the sortable function I used start: and stop: to toggle true or false of a global var

然后,每当摩擦地段内移动时,就会检查是否确实发生拖拉,从而引发我的动).功能。

var dragging = false;

var dragScroll = function() {
    $("#scrollableDiv").mousemove(function(e) {
        if(dragging) {
            if((e.pageY-$(this).offset().top)<80) {
                myScrollFunction( up );
            }
            if((e.pageY-$(this).offset().top)>500) {
                myScrollFunction( down );
            }
        }
    });
};

$(allIds).sortable({
    start: function() { dragging = true; },
    stop: function() { dragging = false; },
    connectWith: ".allLists",
    zIndex: 2
}).disableSelection();

This fixes my issue however, now after the div scrolls, I can t drop the item in the other lists that come into view. Anyway I ll check that out as a separate issue.

问题回答

暂无回答




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...