Próbuję utworzyć uporządkowaną listę elementów, które można przeciągać i klikać za pomocą j ± do sortownego dodatku jQuery UI 1.8.16. Jednak ciągle pojawia się błąd o numerze $("#ol-id ol").sortable is not a function
, z "ol-id" będącym identyfikatorem listy. Mój kod wygląda następująco:jQuery sortable nie jest funkcją
//Sorting stuff
if($("#li-id li").size()>1) {
$("#ol-id ol").sortable({
revert: true,
axis: 'y',
containment: 'parent',
cursor: 'move',
handle: 'div.link_div',
smooth: false,
opacity: 0.7,
tolerance: 'pointer',
start: function(){
$("#ol-id").removeClass("bottom_dragged");
},
update: function(){
$("#ol-id ol").sortable({disabled : true});
$("#saving_indicator").html("saving...")
$("#saving_indicator").show();
//do other stuff...
}
})
}
dziwne, błąd pojawia się w Firebug jako na linii z update: function(){
.
Po sprawdzeniu, że ta funkcja jest wywoływana po załadowaniu strony i załadowaniu biblioteki jQuery. Załączam zarówno jquery-1.6.2.min.js i jquery-ui-1.8.16.custom.min.js w nagłówku. Ponadto zweryfikowałem, że wszystkie nazwy id są poprawne i odpowiadają ich odpowiednikom HTML.
Więc jeśli nie jest to brakujące rzeczy związane z zasobami, co jest przyczyną problemu?
EDIT: tu jest mój nagłówek HTML:
<link href="/_css/styles.css?mod=1317745564" type="text/css" rel="stylesheet">
<link href="/_javascript/qtip/jquery.qtip.min.css?mod=1315947301" type="text/css" rel="stylesheet">
<script type="text/javascript" async="" src="http://www.google-analytics.com/ga.js">
<script type="text/javascript" async="" src="http://www.google-analytics.com/ga.js">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js">
<link rel="stylesheet" type="text/css" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/start/jquery-ui.css">
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/le-frog/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js" type="text/javascript">
<script src="/_javascript/sets.js?mod=1320080042" type="text/javascript"> //Sorting stuff code is here
<script type="text/javascript" src="http://dev.selfcheck.vudat.msu.edu/_javascript/jquery.jsonp.js">
<script type="text/javascript" src="http://dev.selfcheck.vudat.msu.edu/_javascript/jquery.form.js">
<script type="text/javascript" src="http://dev.selfcheck.vudat.msu.edu/_javascript/qtip/jquery.qtip.min.js">
<link href="/_css/ui/ui.core.css?mod=1315947279" type="text/css" rel="stylesheet">
<link href="/_css/ui/ui.theme.css?mod=1315947280" type="text/css" rel="stylesheet">
Czy dodałeś jQuery UI po jQuery? –
Wypróbuj '$ (this) .size ({disabled: true});' wewnątrz 'update', tylko by sprawdzić. – yoda
Po sprawdzeniu, że jQuery UI jest ładowany po jQuery, problem nadal występuje. Ponadto użycie "this" zamiast właściwego id nie usuwa błędu. Dzięki za sugestie! – CodeRedd