Commit 0f23096e by o.kimura

固定ヘッダ対策

parent 6159c69f
......@@ -144,46 +144,35 @@
<link rel="stylesheet" href="/common_previous/css/contact.css">
<?php } ?>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-3405083-1"></script>
<script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-3405083-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'UA-3405083-1');
</script>
<style>
</script>
<style>
/* demo style */
.fixed-nav {
position: fixed;
top: 0;
left: 0;
z-index: 2;
width: 100%;
transition: .3s;
transform: translateY(-100%);
position: fixed;
top: 0;
left: 0;
z-index: 2;
width: 100%;
transform: translateY(-100%);
}
.is-show {
transform: translateY(0);
transform: translateY(0);
}
</style>
<script>
$(function() {
var $win = $(window),
$cloneNav = $('header').clone().addClass('fixed-nav').appendTo('body'),
showClass = 'is-show';
$win.on('load scroll', function() {
var value = $(this).scrollTop();
if ( value > 300 ) {
$cloneNav.addClass(showClass);
} else {
$cloneNav.removeClass(showClass);
}
});
});
</script>
</style>
</head>
<body class="page-<?php echo $pageid; ?>">
......
......@@ -140,6 +140,48 @@ $(function () {
})
});
// ヘッダ固定
$(function () {
var ua = navigator.userAgent;
if (ua.indexOf('iPhone') > 0 || ua.indexOf('Android') > 0 && ua.indexOf('Mobile') > 0) {
// SPではメニュークリックでダイレクト遷移しない
} else {
var $win = $(window),
$cloneNav = $('header').clone().addClass('fixed-nav').appendTo('body'),
showClass = 'is-show';
$win.on('load scroll', function () {
var value = $(this).scrollTop();
if (value > 300) {
$cloneNav.addClass(showClass);
} else {
$cloneNav.removeClass(showClass);
}
});
}
var headerHight = 50;
var spHeaderHight = 100;
$('a[href^=#]').click(function () {
var ua = navigator.userAgent;
if (ua.indexOf('iPhone') > 0 || ua.indexOf('Android') > 0 && ua.indexOf('Mobile') > 0) {
var href = $(this).attr("href");
var target = $(href == "#" || href == "" ? 'html' : href);
var position = target.offset().top - spHeaderHight;
$("html, body").animate({
scrollTop: position
}, 500, "swing");
return false;
} else {
var href = $(this).attr("href");
var target = $(href == "#" || href == "" ? 'html' : href);
var position = target.offset().top - headerHight;
$("html, body").animate({
scrollTop: position
}, 500, "swing");
return false;
}
});
});
/*----------------------------
schedule scroll
----------------------------*/
......
if($(function(){var e=function(){return{option:".c-nav-menu1 li",init:function(){var e=$(this.option),t=this;$(document).off("mouseenter.megaMenuOpen"),$(document).on("mouseenter.megaMenuOpen",this.option,function(){var n=$(this).data("target");return n||($(".c-nav2").hide(),e.removeClass("is-open")),!n||$(this).hasClass("is-open")?!1:(e.removeClass("is-open"),$(this).addClass("is-open"),$(".c-nav2").hide(),$(".c-nav2-"+n).fadeIn("normal"),$(document).off("mouseenter.megaMenuClose"),void t.menuClose())})},menuClose:function(){var e=$(this.option);$(document).on("mouseenter.megaMenuClose","div",function(t){$(t.target).hasClass("c-nav1")||$(t.target).parents(".c-nav")[0]||$(t.target).parents(".c-nav2")[0]||$(t.target).hasClass("c-nav2")||($(".c-nav2").hide(),$(".bg-nav").remove(),e.removeClass("is-open"),$(document).off("mouseenter.megaMenuClose"))})},destroy:function(){$(document).off("mouseenter.megaMenuOpen")}}}();e.init()}),$(window).on("load resize",function(){$(window).width()<=767?($(".menu-icon").off("click").on("click",function(){$(this).toggleClass("is-active"),$(this).parent().next().next().slideToggle()}),$(".nav-sp .c-nav-link1").off("click").on("click",function(){$(this).hasClass("open")?($(this).removeClass("open"),$(this).next().slideToggle()):($(this).addClass("open"),$(this).next().slideToggle())}),$(".c-footer__list >li > .showSp").off("click").on("click",function(e){e.preventDefault(),$(this).next(".c-footer__listsub").slideToggle()}),$(".c-nav2").removeAttr("style")):($(".menu-icon").off("click"),$(".menu-icon").removeClass("is-active"),$(".nav-sp").removeAttr("style"),$(".nav-sp .c-nav-link1").off("click"),$(".nav-sp .c-navSP").removeAttr("style"),$(".c-footer__list >li > .showSp").off("click"),$(".c-footer__listsub").removeAttr("style"))}),$(".c-toTop").length){var scrollTrigger=10,backToTop=function(){var e=$(window).scrollTop();e>scrollTrigger?$(".c-toTop").fadeIn():$(".c-toTop").fadeOut()};backToTop(),$(window).on("scroll",function(){backToTop()}),$(".c-toTop").on("click",function(e){e.preventDefault(),$("html,body").animate({scrollTop:0},400)})}jQuery(document).ready(function(){$(".box-video").click(function(){$("iframe",this)[0].src+="&amp;autoplay=1",$(this).addClass("open")})}),$(function(){$(".tab").click(function(){$(".is-active").removeClass("is-active"),$(this).addClass("is-active"),$(".is-show").removeClass("is-show");const e=$(this).index();$(".tabCont").eq(e).addClass("is-show"),$(window).scroll()})}),$(function(){$("a.btn--stop ,.reserveStop a").click(function(){return!1})}),function(e){e.fn.fixMe=function(){return this.each(function(){function n(){o=t.clone(),o.find("tbody").remove().end().addClass("fixed").insertBefore(t),i()}function i(){o.width(t.outerWidth()),o.find("th").each(function(o){e(this).css("width",t.find("th").eq(o).outerWidth()+"px")})}function s(){var n=e(this).scrollTop(),i=e(this).scrollLeft(),s=e(".header").height();tableOffsetTop=t.offset().top-s,tableOffsetBottom=tableOffsetTop+t.height()-t.find("thead").height(),tableOffsetLeft=t.offset().left,tableOffsetTop>n||n>tableOffsetBottom?o.hide():n>=tableOffsetTop&&tableOffsetBottom>=n&&o.is(":hidden")&&o.show(),o.css({left:tableOffsetLeft-i+"px",top:s})}var o,t=e(this);e(window).resize(i),e(window).scroll(s),n()})}}(jQuery),$(window).on("load",function(){screen.width>767&&$(".schedule-table").fixMe()}),jQuery(window).load(function(){function e(){$("#seminar").trigger("click"),jQuery("html, body").animate({scrollTop:0},0)}""!=window.location.hash&&e(window.location.hash.substr(1))}),$(function(){$(".page-schedule .c-nav-link1, .c-footer__list li a").on("click",function(){$("#seminar").trigger("click")})});
\ No newline at end of file
if($(function(){var e=function(){return{option:".c-nav-menu1 li",init:function(){var e=$(this.option),o=this;$(document).off("mouseenter.megaMenuOpen"),$(document).on("mouseenter.megaMenuOpen",this.option,function(){var n=$(this).data("target");return n||($(".c-nav2").hide(),e.removeClass("is-open")),!n||$(this).hasClass("is-open")?!1:(e.removeClass("is-open"),$(this).addClass("is-open"),$(".c-nav2").hide(),$(".c-nav2-"+n).fadeIn("normal"),$(document).off("mouseenter.megaMenuClose"),void o.menuClose())})},menuClose:function(){var e=$(this.option);$(document).on("mouseenter.megaMenuClose","div",function(o){$(o.target).hasClass("c-nav1")||$(o.target).parents(".c-nav")[0]||$(o.target).parents(".c-nav2")[0]||$(o.target).hasClass("c-nav2")||($(".c-nav2").hide(),$(".bg-nav").remove(),e.removeClass("is-open"),$(document).off("mouseenter.megaMenuClose"))})},destroy:function(){$(document).off("mouseenter.megaMenuOpen")}}}();e.init()}),$(window).on("load resize",function(){$(window).width()<=767?($(".menu-icon").off("click").on("click",function(){$(this).toggleClass("is-active"),$(this).parent().next().next().slideToggle()}),$(".nav-sp .c-nav-link1").off("click").on("click",function(){$(this).hasClass("open")?($(this).removeClass("open"),$(this).next().slideToggle()):($(this).addClass("open"),$(this).next().slideToggle())}),$(".c-footer__list >li > .showSp").off("click").on("click",function(e){e.preventDefault(),$(this).next(".c-footer__listsub").slideToggle()}),$(".c-nav2").removeAttr("style")):($(".menu-icon").off("click"),$(".menu-icon").removeClass("is-active"),$(".nav-sp").removeAttr("style"),$(".nav-sp .c-nav-link1").off("click"),$(".nav-sp .c-navSP").removeAttr("style"),$(".c-footer__list >li > .showSp").off("click"),$(".c-footer__listsub").removeAttr("style"))}),$(".c-toTop").length){var scrollTrigger=10,backToTop=function(){var e=$(window).scrollTop();e>scrollTrigger?$(".c-toTop").fadeIn():$(".c-toTop").fadeOut()};backToTop(),$(window).on("scroll",function(){backToTop()}),$(".c-toTop").on("click",function(e){e.preventDefault(),$("html,body").animate({scrollTop:0},400)})}jQuery(document).ready(function(){$(".box-video").click(function(){$("iframe",this)[0].src+="&amp;autoplay=1",$(this).addClass("open")})}),$(function(){$(".tab").click(function(){$(".is-active").removeClass("is-active"),$(this).addClass("is-active"),$(".is-show").removeClass("is-show");const e=$(this).index();$(".tabCont").eq(e).addClass("is-show"),$(window).scroll()})}),$(function(){$("a.btn--stop ,.reserveStop a").click(function(){return!1})}),$(function(){var e=navigator.userAgent;if(e.indexOf("iPhone")>0||e.indexOf("Android")>0&&e.indexOf("Mobile")>0);else{var o=$(window),t=$("header").clone().addClass("fixed-nav").appendTo("body"),n="is-show";o.on("load scroll",function(){var e=$(this).scrollTop();e>300?t.addClass(n):t.removeClass(n)})}var i=50,s=100;$("a[href^=#]").click(function(){var e=navigator.userAgent;if(e.indexOf("iPhone")>0||e.indexOf("Android")>0&&e.indexOf("Mobile")>0){var o=$(this).attr("href"),t=$("#"==o||""==o?"html":o),n=t.offset().top-s;return $("html, body").animate({scrollTop:n},500,"swing"),!1}var o=$(this).attr("href"),t=$("#"==o||""==o?"html":o),n=t.offset().top-i;return $("html, body").animate({scrollTop:n},500,"swing"),!1})}),function(e){e.fn.fixMe=function(){return this.each(function(){function n(){t=o.clone(),t.find("tbody").remove().end().addClass("fixed").insertBefore(o),i()}function i(){t.width(o.outerWidth()),t.find("th").each(function(t){e(this).css("width",o.find("th").eq(t).outerWidth()+"px")})}function s(){var n=e(this).scrollTop(),i=e(this).scrollLeft(),s=e(".header").height();tableOffsetTop=o.offset().top-s,tableOffsetBottom=tableOffsetTop+o.height()-o.find("thead").height(),tableOffsetLeft=o.offset().left,tableOffsetTop>n||n>tableOffsetBottom?t.hide():n>=tableOffsetTop&&tableOffsetBottom>=n&&t.is(":hidden")&&t.show(),t.css({left:tableOffsetLeft-i+"px",top:s})}var t,o=e(this);e(window).resize(i),e(window).scroll(s),n()})}}(jQuery),$(window).on("load",function(){screen.width>767&&$(".schedule-table").fixMe()}),jQuery(window).load(function(){function e(){$("#seminar").trigger("click"),jQuery("html, body").animate({scrollTop:0},0)}""!=window.location.hash&&e(window.location.hash.substr(1))}),$(function(){$(".page-schedule .c-nav-link1, .c-footer__list li a").on("click",function(){$("#seminar").trigger("click")})});
\ No newline at end of file
......@@ -186,12 +186,22 @@
$(window).load(function() {
var lochref = window.location.href;
if (lochref.indexOf('#') > -1) {
var anchor = lochref.slice(lochref.indexOf('#'));
window.setTimeout(function() {
$('body, html').animate({
scrollTop: $(anchor).offset().top
var ua = navigator.userAgent;
if (ua.indexOf('iPhone') > 0 || ua.indexOf('Android') > 0 && ua.indexOf('Mobile') > 0) {
var anchor = lochref.slice(lochref.indexOf('#'));
window.setTimeout(function() {
$('body, html').animate({
scrollTop: ($(anchor).offset().top - 100)
}, 500);
}, 500);
}, 500);
} else {
var anchor = lochref.slice(lochref.indexOf('#'));
window.setTimeout(function() {
$('body, html').animate({
scrollTop: ($(anchor).offset().top - 50)
}, 500);
}, 500);
}
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment