主な理由は、script
タグを の子として持っていることです#sortable1
。このため、$( "#sortable1 li:nth-child(1)" )
セレクターは目的の結果を生成していません
考えられる解決策の1つは、試してみることです
$( "#sortable1 li:eq(1)" )
より良い解決策として、次のようなものを使用することをお勧めします
$(function() {
$( "#sortable1 > li").hover(function(){
$(this).next().children('div').removeClass( "boxxySTILL", 200, "linear" ).addClass( "boxxy", 200, "linear" );
}, function(){
$(this).next().children('div').removeClass( "boxxy", 200, "linear" ).addClass( "boxxySTILL", 200, "linear" );
});
});
li
このようなすべてのハンドラーを登録する代わりに
$(function() {
$( "#sortable1 li:nth-child(1)" ).mouseenter(function() {
$( "#theone1" ).removeClass( "boxxySTILL", 200, "linear" ).addClass( "boxxy", 200, "linear" );
});
$(function() {
$( "#sortable1 li:nth-child(1)" ).mouseleave(function() {
$( "#theone1" ).removeClass( "boxxy", 200, "linear" ).addClass( "boxxySTILL", 200, "linear" );
});
});
});