0

I have these js files:

https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
http://code.jquery.com/ui/1.8.18/jquery-ui.min.js
Functions.js

and this html:

<ul id="sortable">
    <li>Item 1</li>
    <li>Item 2</li>
    <li>Item 3</li>
    <li>Item 4</li>
    <li>Item 5</li>
</ul>

in Functions.js, I have:

$(function () {
    $("#sortable").sortable({
        cancel: ".fixed"
    });
    $("#sortable").disableSelection();
});

in my jsfiddle, it works:

http://jsfiddle.net/alonshmiel/ZV6sF/1/

but in my project, when I try to choose li and order it after another li, the scroll is going down till the bottom of the page.

is there someone that has an idea why it's happening?

any help appreciated!

1 Answer 1

1

You could set the containment option for the sortable, so that the list elements can only be dragged within their container. For example:

$(function () {
    $("#sortable").sortable({
        cancel: ".fixed",
        containment: "#sortable"
    });
    $("#sortable").disableSelection();
});
2
  • @PertaStone, thank you but it doesn't work.. the page is still going to the bottom when I drag an li.. Commented Sep 21, 2013 at 10:34
  • @AlonShmiel, it works fine for me in Chrome and Firefox, with no unwanted scrolling. Commented Sep 21, 2013 at 11:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.