$(function() { // コンテンツをフワッと表示 var contents = $('#contents'); contents.hide(); contents.fadeIn(3000); // ページトップへ $('body').append(''); var topBtn = $('#page-top'); topBtn.hide(); $(window).scroll(function () { if ($(this).scrollTop() > 100) { topBtn.fadeIn(); } else { topBtn.fadeOut(); } }); topBtn.click(function () { $('body,html').animate({ scrollTop: 0 }, 500); return false; }); // レビュー var review = parseInt($('#reviewAverage').text() , 10); var star1 = '' + '★'.repeat(Math.ceil(review)) + ''; var star2 = '' + '★'.repeat(5 - Math.ceil(review)) + ''; $('#reviewAverage').html(star1 + star2); });