简体   繁体   中英

jquery sortable, IE, and infinite scrolling

check out this fiddle in IE:

http://jsfiddle.net/GA4Qs/108/

notice the style style="position:relative;clear:both;max-height:100px;overflow:auto;"

basically, I want it so that when you scroll and drag down to the bottom of the scrollable div, it will scroll accordingly. The problem is in IE, you will be able to drag the item to the bottom such that it will scroll infinitely

Is there a way to prevent that from happening in IE so that it will stop at the bottom when dragging the sortable item down instead of having it scroll infinitely?

I don't know much on this subject but you can use the containment option that JQuery has on its movable objects Like so:

$('#psP').sortable({
placeholder: "ui-state-highlight",
helper:'clone',
containment: "parent"
});

Also remove Overflow:auto;

here is your updated jsFiddle. NOTE: you will need to fiddle around with the sizes of things as with the fiddle i gave you it doesn't allow you to drop into the sortable area. this is due to the containment area and the sizes of your DIV's. It shouldn't be to hard to figure out.

I Hope this is what you were looking for.

 $(".sortable_portlets").sortable({
                    connectWith: ".portlet-drag",
                    revert: 'true',
                    items: ".sortable_portlets",
                    containment: "document",
                    axis :'x',
                    scroll: false,

                  });

the containment option will limit your scrolling. there are other ways as well.you may set axis to restrict this.

使用Overflow:hidden,containment:'parent',如果需要,还可以限制轴为'x'或'y'。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM