2016-01-12 3 views
-1

URL-адрес: https://johnny.github.io/jquery-sortable/Как запустить jquery сортировать в localhost?

загрузить и запустить его на локальном хосте, но это не работает

Я бегу example.html

Мой URL выглядит так: http://localhost/ngetest/drag_drop/source/example.html

Результат:

I upd ate example.html:

<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> 

Но все равно. Это не работает

Спасибо

+0

Проверьте, есть ли у вас какие-либо ошибки? –

+0

Включили ли вы jQuery? – abhishekkannojia

+0

Похоже, вы забыли включить jQuery. Пожалуйста, включите его. –

ответ

1

отлично работает:

$(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>

+0

Мне нужна помощь, Посмотрите здесь: http://stackoverflow.com/questions/35640041/how-to-validation-of-input-text-field-in- ajax? noredirect = 1 # comment58961736_35640041 –

+0

@mosestoh Sure ... –

1

Причина, когда она не работает на localhost его потому, что, возможно, вы не включили 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> 
 
\t <title>Sortable</title> 
 
</head> 
 

 
<body> 
 
    <ol class='example'> 
 
\t <li>First</li> 
 
\t <li>Second</li> 
 
\t <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>

+0

Действительно ли это работает в вашей вышеупомянутой скрипке? –

+0

Сравните ваш с моим и посмотрите ... –

+0

Да, так оно и есть. Зачем спрашивать? –

Смежные вопросы