Skip to main content

Search and Top Navigation

Ticket #5863: sortable_cancel_problem.html


File sortable_cancel_problem.html, 1.0 KB (added by pboyd, July 26, 2010 06:34PM UTC)

Move the second item in the list to see the problem.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js" type="text/javascript"></script>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(function() {
                $("ol").sortable({
                    start: function(event, ui) {
                        if (ui.item.hasClass('nodrag')) {
                            $(this).cancel();
                        }
                    }
                });
            });
        </script>
    </head>
    <body>
        <ol>
            <li>Item #1</li>
            <li class="nodrag">Item #2</li>
            <li>Item #3</li>
        </ol>
    </body>
</html>

Download in other formats:

Original Format