Commit 853c248e by o.kimura

メニュー表示色調整・スクロール阻止

parent 8d9c5b0e
$(document).ready( function() { $(document).ready(function () {
mobileNav(); mobileNav();
smoothScroll(); smoothScroll();
gSearch(); gSearch();
}); });
$( function () { $(function () {
/* 言語切り替え */ /* 言語切り替え */
$('#lang select').change( function() { $('#lang select').change(function () {
if ($(this).val() != '') { if ($(this).val() != '') {
window.location.href = $(this).val(); window.location.href = $(this).val();
} }
...@@ -17,19 +17,25 @@ $( function () { ...@@ -17,19 +17,25 @@ $( function () {
var toggle = $('#toggle_btn'); var toggle = $('#toggle_btn');
var toggle_menu = $('#toggle_menu'); var toggle_menu = $('#toggle_menu');
var overlay = $('.overlay'); var overlay = $('.overlay');
toggle.on( 'click', function() { toggle.on('click', function () {
if ( $(this).hasClass('active') ) { if ($(this).hasClass('active')) {
$(this).removeClass('active'); $(this).removeClass('active');
toggle_menu.slideUp('fast'); toggle_menu.slideUp('fast');
overlay.slideUp('fast'); overlay.slideUp('fast');
$("html").css("overflow-y", "auto");
$("body").removeClass('active');
} else { } else {
$(this).addClass('active'); $(this).addClass('active');
toggle_menu.slideDown('fast'); toggle_menu.slideDown('fast');
overlay.slideDown('fast'); overlay.slideDown('fast');
$("html").css("overflow-y", "hidden");
setTimeout(function () {
$("body").addClass('active');
}, 100);
} }
return false; return false;
}); });
overlay.on( 'click', function(){ overlay.on('click', function () {
toggle.removeClass('active'); toggle.removeClass('active');
toggle_menu.slideUp('fast'); toggle_menu.slideUp('fast');
overlay.slideUp('fast'); overlay.slideUp('fast');
...@@ -39,11 +45,11 @@ $( function () { ...@@ -39,11 +45,11 @@ $( function () {
}); });
/* モバイル用ナビゲーション */ /* モバイル用ナビゲーション */
var mobileNav = ( function() { var mobileNav = (function () {
var openFlg = 0; var openFlg = 0;
var ua = navigator.userAgent; var ua = navigator.userAgent;
$('#toggle').click(function(){ $('#toggle').click(function () {
if(openFlg == 0){ if (openFlg == 0) {
$('#navi').addClass("open"); $('#navi').addClass("open");
$('#toggle').addClass("open"); $('#toggle').addClass("open");
$('#head_menu').addClass("open"); $('#head_menu').addClass("open");
...@@ -68,7 +74,7 @@ var mobileNav = ( function() { ...@@ -68,7 +74,7 @@ var mobileNav = ( function() {
}); });
var gSearch = ( function() { var gSearch = (function () {
var cx = '002492979778199743801:oaprkry4gm4'; var cx = '002492979778199743801:oaprkry4gm4';
var gcse = document.createElement('script'); var gcse = document.createElement('script');
gcse.type = 'text/javascript'; gcse.type = 'text/javascript';
...@@ -80,16 +86,15 @@ var gSearch = ( function() { ...@@ -80,16 +86,15 @@ var gSearch = ( function() {
}); });
/* smooth scroll */ /* smooth scroll */
var smoothScroll = ( function() { var smoothScroll = (function () {
$('.pagetop a').click(function() { $('.pagetop a').click(function () {
var speed = 400; var speed = 400;
var href= $(this).attr("href"); var href = $(this).attr("href");
var target = $(href == "#" || href == "" ? 'html' : href); var target = $(href == "#" || href == "" ? 'html' : href);
var position = target.offset().top; var position = target.offset().top;
$('body,html').animate({scrollTop:position}, speed, 'swing'); $('body,html').animate({
scrollTop: position
}, speed, 'swing');
return false; return false;
}); });
}); });
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