$(function(){ $menu = $('.reception_menu article > div'); $menu.hide(); $menu.eq(0).show(); tabHTML = ""; for(i=0; i<$menu.length; i++){ if( i==0 ) tabHTML += '01\n'; else tabHTML += '0' + (i+1) + '\n'; } $('.reception_menu nav').html(tabHTML); $('.reception_menu nav span').on('click', function(){ if( !$(this).hasClass('on') ){ $(this).parent().find('span').removeClass('on'); $(this).addClass('on'); $menu.hide(); $menu.eq($(this).index()).fadeIn(300); } }); }); $(window).load(function(){ var windowWidth = $(window).width(), targetWidth = 800 $dinnerListWrap = $('.shop-list'); //console.log('load'); var functionJs = function (){ windowWidth = $(window).width(); //画面サイズによって振り分け if($dinnerListWrap.length){ if (windowWidth >= targetWidth) { $dinnerListWrap.find('li .title').autoHeight({ height:'height', reset:'reset'}); $dinnerListWrap.find('li p').autoHeight({ height:'height', reset:'reset'}); $dinnerListWrap.find('li .outline').autoHeight({ height:'height', reset:'reset'}); } else { $dinnerListWrap.find('li .title, li p, li .outline').css('height', 'auto'); } } } functionJs(); //リサイズ時の処理 $(window).resize(function() { var timer = false; if (timer !== false) { clearTimeout(timer); } timer = setTimeout(function() { functionJs(); }, 100); }); });