Commit a61d0353 by o.kimura

うつくしトイレ、Google検索制御

parent 53e5442d
Showing with 91 additions and 85 deletions
$(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();
} }
}); });
// toggle menu // toggle menu
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("position", ""); $("html").css("position", "");
$("body").removeClass('active'); $("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("position", "fixed"); $("html").css("position", "fixed");
$("html").css("width", "100%"); $("html").css("width", "100%");
setTimeout(function () { setTimeout(function () {
$("body").addClass('active'); $("body").addClass('active');
}, 100); }, 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');
}); });
setTimeout(function () { setTimeout(function () {
$("#gsc-i-id1").attr("placeholder", "サイト内検索"); $("#gsc-i-id1").attr("placeholder", "サイト内検索");
$("#gsc-i-id1").css("background", "none"); $("#gsc-i-id1").css("background", "none");
$("#gsc-i-id1").css("font-family", 'Verdana, Roboto, "Droid Sans", "游ゴシック", YuGothic, "メイリオ", Meiryo, "ヒラギノ角ゴ ProN W3", "Hiragino Kaku Gothic ProN", "MS Pゴシック", sans-serif'); $("#gsc-i-id1").css("font-family", 'Verdana, Roboto, "Droid Sans", "游ゴシック", YuGothic, "メイリオ", Meiryo, "ヒラギノ角ゴ ProN W3", "Hiragino Kaku Gothic ProN", "MS Pゴシック", sans-serif');
}, 1200); }, 1200);
$("#head_area,#toggle_menu").on("click", function (e) {
$("#gsc-i-id1").css("background", "none");
$("#gsc-i-id1").attr("placeholder", "サイト内検索");
$("#gsc-i-id1").css("font-family", 'Verdana, Roboto, "Droid Sans", "游ゴシック", YuGothic, "メイリオ", Meiryo, "ヒラギノ角ゴ ProN W3", "Hiragino Kaku Gothic ProN", "MS Pゴシック", sans-serif');
});
}); });
/* モバイル用ナビゲーション */ /* モバイル用ナビゲーション */
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");
$('#menu01').addClass("open"); $('#menu01').addClass("open");
$('#head_area .search').addClass("open"); $('#head_area .search').addClass("open");
$('header h1').addClass("non"); $('header h1').addClass("non");
$('header #title').addClass("non"); $('header #title').addClass("non");
$('#lang').addClass("non"); $('#lang').addClass("non");
openFlg = 1; openFlg = 1;
} else { } else {
$('#navi').removeClass("open"); $('#navi').removeClass("open");
$('#toggle').removeClass("open"); $('#toggle').removeClass("open");
$('#head_menu').removeClass("open"); $('#head_menu').removeClass("open");
$('#menu01').removeClass("open"); $('#menu01').removeClass("open");
$('#head_area .search').removeClass("open"); $('#head_area .search').removeClass("open");
$('header h1').removeClass("non"); $('header h1').removeClass("non");
$('header #title').removeClass("non"); $('header #title').removeClass("non");
$('#lang').removeClass("non"); $('#lang').removeClass("non");
openFlg = 0; openFlg = 0;
} }
}); });
}); });
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';
gcse.async = true; gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
'//cse.google.com/cse.js?cx=' + cx; '//cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0]; var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s); s.parentNode.insertBefore(gcse, s);
}); });
/* 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({ $('body,html').animate({
scrollTop: position scrollTop: position
}, speed, 'swing'); }, 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