// JavaScript Document
jQuery(document).ready(function($) {
//Scroll down button
$(".sroll_field").click(function(){
$('html,body').animate({scrollTop:$(".list_news_container_index").offset().top-100},1000);
});
var content_height=0;
overview_page=$(".content_inc .history_next_content").length;
$(".page_content").each(function(){
content_height=$(this).height() + content_height;
if(overview_page>0){
content_height=content_height-225;
}
//$(".content_inc").css({"padding-bottom":content_height+"px"});
});
$(".q_and_a_list .q").each(function() {
$(this).click(function(){
$(this).next().stop().slideToggle();
$("dd",this).stop().toggleClass("open_btn");
});
});
//Set height for overview page
var overview_height=$(".overview_page .page_content").height()-450;
$(".history_next_content").animate({top:overview_height+"px"});
//Toggle mobile menu
//Add home menu
var home_link=$(".header_logo a").attr("href");
$("ul#primary_menu-top-id").prepend('
最新情報 ');
$("#top_menu_icon").click(function(){
$("ul#primary_menu-top-id").stop().toggleClass("open");
$("body").stop().toggleClass("push");
if($(this).hasClass("open")){
$(this).removeClass("open");
}
else{
$(this).addClass("open");
}
});
//Set icon menu middle (header)
var h_of_logo=$(".header_logo").height();
var mar_icon_menu=((h_of_logo-35)/2);
if(mar_icon_menu>0){
$("#top_menu_icon").css({"margin-top":mar_icon_menu+"px"});
}
//Show - hide back top button
$(window).scroll(function() {
if ($(this).scrollTop()+50) {
//$('#back_top_content').stop(true, true).fadeIn();
} else {
//$('#back_top_content').stop(true, true).fadeOut();
}
if($(document).scrollTop() > 20){
if(!$("#top_menu_icon").hasClass("open")){
$("#top_menu_icon").css({"opacity":"0"});
}
}
else{
$("#top_menu_icon").css({"opacity":"1"});
}
});
//Mobile Footer menu
$(".mobile_footer_menu").click(function(){
$(".menu_item_view_footer").stop().slideToggle();
$(this).stop().toggleClass("green_open_icon");
});
/* Fixed Breadcrumb selector */
$('>').insertAfter('.breadcrumbs_item li.home');
/* Set height of main top in news page */
var main_top_news_page=$(".news_template_page .main_top_page").innerHeight();
var news_page_content=$(".news_page_detail_list").innerHeight();
var pad_main_top_news_page=news_page_content-main_top_news_page;
var vs_1000= window.matchMedia("only screen and (max-width: 1000px)");
var vs_767= window.matchMedia("only screen and (max-width: 767px)");
$(window).on('load resize',function(){
/* CSR Page */
var csr_post_selector=$(".csr_posts .category1");
csr_post_selector.each(function(){
var h_of_tmb=$(this).find(".tmb").innerHeight();
var h_of_content=$(this).find(".content").innerHeight();
var mar_middle=(h_of_tmb-h_of_content)/2;
if(mar_middle>0){
$(this).find(".content").css({"margin-top":mar_middle+"px"});
};
});
//Begin code map
var styles = [
{
stylers: [
{ saturation: -100 }
]
},{
featureType: "road",
elementType: "geometry",
stylers: [
// { lightness: 100 },
{ visibility: "simplified" }
]
},{
featureType: "road",
elementType: "labels",
stylers: [
{ visibility: "off" }
]
}
];
var styledMap = new google.maps.StyledMapType(styles,
{name: "Styled Map"});
var myLatlng = new google.maps.LatLng(33.238806, 131.608766);
var iconURLPrefix = 'http://b-plusg.co.jp/cms/wp-content/themes/bpg/img/overview/';
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
icon: iconURLPrefix+'map-icon.png',
zIndex:0
});
var mapOptions = {
zoom: 6,
center: myLatlng,
scrollwheel: false,
mapTypeControlOptions: {
mapTypeIds: [google.maps.MapTypeId.ROADMAP, 'map_style']
},
zoomControl: true,
zoomControlOptions: {
position: google.maps.ControlPosition.RIGHT_CENTER
}
};
// Define your locations: HTML content for the info window, latitude, longitude
var locations = [
['ELGRAN(エルグラン)町田店
〒194-0013
東京都町田市原町田6丁目19-15
電話番号 042-732-1355
営業時間 10:00 ~ 22:45
', 35.543864, 139.447350],
['大吉 大和柳橋店
〒242-0022
神奈川県大和市柳橋5-12-34
電話番号 046-201-0377
営業時間 9:00 ~ 22:45
', 35.453095, 139.456203],
['ELGRAN(エルグラン)明野本店
〒870-0147
大分県大分市大字小池原934-1
電話番号 097-556-1725
営業時間 10:00~22:45
', 33.238303, 131.661199],
['E・L・L・E(エル)菊池店
〒861-1323
熊本県菊池市西寺1522
電話番号 0968-24-7010
営業時間 10:00 ~ 22:45
', 32.976340, 130.796614],
['ELGRAN(エルグラン)日向店
〒883-0062
宮崎県日向市日知屋3380-5
電話番号 0982-50-3600
営業時間 10:00 ~ 22:45
', 32.426319, 131.651294],
['ELGRAN(エルグラン)西町本店
〒900-0036
沖縄県那覇市西二丁目19-1
電話番号 098-866-4800
営業時間 9:00 ~ 23:45
', 26.214138, 127.668453],
['ELGRAN(エルグラン)大山店
〒901-2223
沖縄県宜野湾市大山7丁目1350-24
電話番号 098-897-8787
営業時間 9:00 ~ 23:45
', 26.286375, 127.744250]
];
// Setup the different icons and shadows
var icons = [
iconURLPrefix + 'icon_map_store1.png',
iconURLPrefix + 'icon_map_store2.png',
iconURLPrefix + 'icon_map_store3.png',
iconURLPrefix + 'icon_map_store4.png',
iconURLPrefix + 'icon_map_store5.png',
iconURLPrefix + 'icon_map_store6.png',
iconURLPrefix + 'icon_map_store7.png'
]
var iconsLength = icons.length;
var map = new google.maps.Map(document.getElementById('map-canvas'),mapOptions);
map.mapTypes.set('map_style', styledMap);
map.setMapTypeId('map_style');
marker.setMap(map);
var infowindow = new google.maps.InfoWindow({
maxWidth: 300
});
var markers = new Array();
var highestZIndex = 0;
var iconCounter = 0;
for (var i = 0; i < locations.length; i++) {
var marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
map: map,
icon: icons[iconCounter]
});
map.mapTypes.set('map_style', styledMap);
map.setMapTypeId('map_style');
markers.push(marker);
marker.set("myZIndex", marker.getZIndex());
google.maps.event.addListener(marker, 'mouseover',function() {
//alert('aaaa');
this.setOptions({zIndex:this.get("myZIndex")});
});
google.maps.event.addListener(marker, 'mouseout',function() {
getHighestZIndex();
this.setOptions({zIndex:highestZIndex+1});
});
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})(marker, i));
iconCounter++;
// We only have a limited number of possible icon colors, so we may have to restart the counter
if(iconCounter >= iconsLength) {
iconCounter = 0;
}
}
function getHighestZIndex() {
// if we haven't previously got the highest zIndex
// save it as no need to do it multiple times
if (highestZIndex==0) {
if (markers.length>0) {
for (var i=0; ihighestZIndex) {
highestZIndex = tempZIndex;
}
}
}
}
return highestZIndex;
}
function autoCenter() {
// Create a new viewpoint bound
var bounds = new google.maps.LatLngBounds();
// Go through each...
for (var i = 0; i < markers.length; i++) {
bounds.extend(markers[i].position);
}
// Fit these bounds to the map
map.fitBounds(bounds);
}
autoCenter();
//End code map
if(vs_767.matches)
{
//Set icon menu middle (header) when resizing
var h_of_logo=$(".header_logo").height();
var mar_icon_menu=((h_of_logo-35)/2);
if(mar_icon_menu>0){
$("#top_menu_icon").css({"margin-top":mar_icon_menu+"px"});
}
}
else
{
//$(".page_title").addClass("mid_screen");
$(".header_menu").css({"padding-top":0});
$(".csr_posts .category2").each(function(){
h_of_content=$(this).find(".content").innerHeight()-25;
$(this).css({"padding-bottom":h_of_content+"px"});
});
}
});
});