2016-01-12 69 views
-1

的网址:https://johnny.github.io/jquery-sortable/如何在本地主机上运行jquery排序?

我下载和本地主机上运行它,但它不工作

我跑example.html的

我的网址是这样的:http://localhost/ngetest/drag_drop/source/example.html

结果:

我upd吃了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当然... –

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

是的。为什么这么问? –

相关问题