/** * 追記:170405 */ $(function () { $('.kanren-hotel').on('mouseover',function(){ wn = '.' + $(this).data('tgt'); $(wn).fadeIn(); $("body").css({overflow:'hidden'}); }); $('.close,.modalBK,.modalClose').click(function(){ $(wn).fadeOut(); $("body").css({overflow:'visible'}); }); /** * スクロールイベント */ var $body = $('body'), $nav = $('#tourNabBar'), $section = $('div.tourCont02'), navOffsetTop = $nav.offset().top, navHeight = $nav.innerHeight(), navMargin = 100, current = -1; changeNavCurrent(0); $(window).on('scroll', function () { // ナビバー固定 if($(this).scrollTop() > navOffsetTop) { $body.addClass('is-fixed'); } else { $body.removeClass('is-fixed'); } // ナビバー色変え for( var i=$section.length; i--; ){ if ($(window).scrollTop() > $section.eq(i).offset().top - navMargin ) { changeNavCurrent(i); break; } } }); // ナビバー色変え function changeNavCurrent(curNum) { if (curNum != current) { current = curNum; var nth = curNum + 1; $('#tourNabBar ul > li').removeClass('current'); $('#tourNabBar ul > li:nth-child(' + nth +')').addClass('current'); } } /** * ページ内リンク */ $('a[href^=#].smoothScroll').click(function() { var speed = 600; // ミリ秒 var href= $(this).attr("href"); var target = $(href == "#" || href == "" ? 'html' : href); // 移動先を数値で取得 var position = $(this).hasClass('tabScroll') ? target.offset().top - navHeight: target.offset().top ; $('body,html').animate({scrollTop:position}, speed, 'swing'); return false; }); }); $(window).on('load',function(){ /** * カレンダーチェックボックスツールチップ */ $('#jsTipCalendarPrice').each(function(){ var $tip = $(this); var height = $tip.outerHeight(true); $('#wrapper').on({ mouseenter:function(){ if( !$tip.hasClass('show') ){ var offset = $(this).offset(); $tip.css({ left: offset.left, top: offset.top - height }); $tip.addClass('show'); } }, mouseleave:function(){ if( $tip.hasClass('show') ) { $tip.removeClass('show'); } } }, '#callst td'); }); /** * カレンダー日付ツールチップ */ $('#jsTipCalendarDate').each(function(){ var $tip = $(this); var width = $tip.outerWidth(true); var height = $tip.outerHeight(true); $('#wrapper').on({ mouseenter:function(){ if( !$tip.hasClass('show') && this.id && $('#jsTipCalendarDate').html() !='' ){ var offset = $(this).offset(); $tip.css({ left: offset.left - ((width - $(this).outerWidth()) / 2), top: offset.top - height }); $tip.addClass('show'); } }, mouseleave:function(){ if( $tip.hasClass('show') && $('jsTipCalendarDate').html() !='' ){ $tip.removeClass('show'); } } }, '#allcal td'); }); });