$(function(){ /* ★★★ テーブルのスマホ用 見出し生成 ★★★ */ $th = $(".enq_detail tbody tr th"); tableHTML = $(".enq_detail tbody").html(); $enqRank = $(".enq_cmt_tit h4"); $(".enq_detail tbody tr th").each(function(i){ tableHTML = tableHTML.replace($(this).html(), $enqRank.eq(i).text().replace(/[0-9]位/gm,"")); }); tableHTMLsplit = tableHTML.split(""); tableHTML = ""; for(i=1; i\n"; tableHTML += "" + tableHTMLsplit[i]; } $(".enq_detail tbody").html(tableHTML); /* ★★★ 自動的に「スタッフ」「男性」「女性」を判別 ★★★ */ $(".enq_cmt_cont p").each(function(){ if( $(this).html().indexOf("span class=\"comm\">★") != -1 ){ $(this).addClass("staff"); }else if( $(this).text().indexOf("\(男性\)") != -1 || $(this).text().indexOf("(男性)") != -1){ $(this).addClass("male"); }else if( $(this).text().indexOf("\(女性\)") != -1 || $(this).text().indexOf("(女性)") != -1){ $(this).addClass("female"); } }); /* ★★★ スマホの場合、コンテンツの Open Close ★★★ */ $(".enq_cmt_tit").click(function(){ if($(window).width() < 800){ $(this).next(".enq_cmt_cont").slideToggle("400"); if($(this).hasClass("on")) $(this).removeClass("on"); else $(this).addClass("on"); } }); });