jQuery(function ($) { let cat_ul_count = $('.post-order-list').length; //カテゴリ総数 for (let i = 0; i < cat_ul_count; i++) { let my_list = $('.post-order-list:eq(' + i + ')'); my_list.sortable( { update: function () { let list_count = $('.product-list', my_list).length; for (let j = 0; j < list_count; j++) { let list_order = j + 1; $('.list_order:eq(' + j + ')', my_list).val(list_order); $('.list_order:eq(' + j + ')', my_list).siblings('.sort-num-label').text(list_order); } } } ); my_list.disableSelection(); } $('.post-order-nav li').click(function () { if (!$(this).hasClass('en')) { let target_index = $(this).index(); $('.post-order-nav li').removeClass('en'); $(this).addClass('en'); $('.post-order-box').hide(); $('.post-order-box:eq(' + target_index + ')').show(); } }); });