-1

The URL : https://johnny.github.io/jquery-sortable/

I download and run it on localhost, but it's not working

I run example.html

My URL is like this : http://localhost/ngetest/drag_drop/source/example.html

The result :

I update example.html to be like this :

<style type="text/css">
    body.dragging, body.dragging * {
      cursor: move !important;
    }

    .dragged {
      position: absolute;
      opacity: 0.5;
      z-index: 2000;
    }

    ol.example li.placeholder {
      position: relative;
      /** More li styles **/
    }
    ol.example li.placeholder:before {
      position: absolute;
      /** Define arrowhead **/
    }
</style>

<ol class='example'>
  <li>First</li>
  <li>Second</li>
  <li>Third</li>
</ol>
<script src='js/jquery-sortable.js'></script>

<script type="text/javascript">
    $(function  () {
      $("ol.example").sortable();
    });
</script>

But just the same. It's not working

Thank you

7
  • Check your browser console do you get any error? Commented Jan 12, 2016 at 10:18
  • Did you include jQuery ? Commented Jan 12, 2016 at 10:18
  • Looks like you forgot to include jQuery. Kindly include it. Commented Jan 12, 2016 at 10:19
  • Please check console, you have included jquery-sortable which in turn depends on jquery library. Please include that too. Commented Jan 12, 2016 at 10:24
  • 1
    @Praveen Kumar, I'm sorry Commented Jan 12, 2016 at 10:38

2 Answers 2

1

Works perfectly fine:

$(function  () {
  $("ol.example").sortable();
});
body.dragging, body.dragging * {
  cursor: move !important;
}

.dragged {
  position: absolute;
  opacity: 0.5;
  z-index: 2000;
}

ol.example li.placeholder {
  position: relative;
  /** More li styles **/
}
ol.example li.placeholder:before {
  position: absolute;
  /** Define arrowhead **/
}
<script src="https://johnny.github.io/jquery-sortable/js/application.js"></script>

<ol class='example'>
  <li>First</li>
  <li>Second</li>
  <li>Third</li>
</ol>

Sign up to request clarification or add additional context in comments.

1 Comment

I need you help, Look here : stackoverflow.com/questions/35640041/…
1

The reason when it didn't work on localhost its because maybe you didn't include jQuery

$(function  () {
  $("ol.example").sortable();
});
      body.dragging, body.dragging * {
  cursor: move !important;
}

.dragged {
  position: absolute;
  opacity: 0.5;
  z-index: 2000;
}

ol.example li.placeholder {
  position: relative;
  /** More li styles **/
}
ol.example li.placeholder:before {
  position: absolute;
  /** Define arrowhead **/
}
<!DOCTYPE html>
<html>
<head>
	<title>Sortable</title>
</head>

<body>
   <ol class='example'>
	  <li>First</li>
	  <li>Second</li>
	  <li>Third</li>
    </ol>

<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<script type="text/javascript" src="https://johnny.github.io/jquery-sortable/js/jquery-sortable.js"></script>
</body>
</html>

3 Comments

Yes it does. Why ask?
Yer @PraveenKumar, I have seen the different but for the main point is to point out that he forgot to include jQuery to his project.
Yup.. That's fine. My mistake. Sorry.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.