$(function () { if ( $.browser.msie ){ if($.browser.version == '8.0') { $('html').addClass('ie ie8'); } else if($.browser.version == '9.0') { $('html').addClass('ie ie9'); } } // rollover $('.rollover').each(function () { this.osrc = $(this).attr('src'); this.rollover = new Image(); this.rollover.src = this.osrc.replace(/(\.gif|\.jpg|\.png)/, "_o$1"); }).hover(function () { $(this).attr('src', this.rollover.src); }, function () { $(this).attr('src', this.osrc); }); // Navigation Scroll $(window).scroll(function (event) { Scroll(); }); // User define function function Scroll() { var contentTop = []; var contentBottom = []; var winTop = $(window).scrollTop(); var rangeTop = 200; var rangeBottom = 500; $('.nav-02 ul li').find('a').each(function () { var menu = $(this).attr('href'); if (menu.indexOf('#') != -1) { if ($($(this).attr('href')).length) { contentTop.push($($(this).attr('href')).offset().top); } } }); $.each(contentTop, function (i) { if (winTop > contentTop[i] - rangeTop) { $('.nav-02 ul li') .removeClass('active') .eq(i).addClass('active'); } }); } menuSpToggle(); pageScroll(); //$('.visual-01 .visual-inner, .list-sec-05').css({backgroundSize: "cover"}); text_middle(); // add class for last-child $('#content > :last-child').addClass('last-child'); }); var checked; $('#navbar').on('show.bs.collapse', function () { $('body').addClass('modal-open'); }) $('#navbar').on('hidden.bs.collapse', function () { $('body').removeClass('modal-open'); }) function menuSpToggle() { if ($(window).width() < 768) { //$('body').addClass('modal-open'); if (checked != 1) { $('.gNav > .has-sub').on('click', function () { var _this = $(this); if (!_this.hasClass('hover')) { _this.parent().find('li').removeClass('hover').children('.gNav-sub').hide(); _this.addClass('hover').children('.gNav-sub').show(); } else { _this.removeClass('hover').children('.gNav-sub').hide(); } }) checked = 1; } } else { if (checked == 1) { $('.gNav').find('li').removeClass('hover').children('.gNav-sub').hide(); } $('#navbar').collapse('hide'); // $('body').removeClass('modal-open'); $('.gNav-sub').removeAttr("style"); } } /* !isUA -------------------------------------------------------------------- */ var isUA = (function () { var ua = navigator.userAgent.toLowerCase(); indexOfKey = function (key) { return (ua.indexOf(key) != -1) ? true : false; } var o = {}; o.ie = function () { return indexOfKey("msie"); } o.fx = function () { return indexOfKey("firefox"); } o.chrome = function () { return indexOfKey("chrome"); } o.opera = function () { return indexOfKey("opera"); } o.android = function () { return indexOfKey("android"); } o.ipad = function () { return indexOfKey("ipad"); } o.ipod = function () { return indexOfKey("ipod"); } o.iphone = function () { return indexOfKey("iphone"); } return o; })(); /* !pageScroll -------------------------------------------------------------- */ var pageScroll = function () { jQuery.easing.easeInOutCubic = function (x, t, b, c, d) { if ((t /= d / 2) < 1) return c / 2 * t * t * t + b; return c / 2 * ((t -= 2) * t * t + 2) + b; }; $('a.scroll, .scroll a, .pageTop a, area.scroll').each(function () { $(this).bind("click keypress", function (e) { e.preventDefault(); var target = $(this).attr('href'); var targetY = $(target).offset().top - $('#navbar-fix').height(); var parent = ( isUA.opera() ) ? (document.compatMode == 'BackCompat') ? 'body' : 'html' : 'html,body'; $(parent).animate( {scrollTop: targetY }, 400, 'easeInOutCubic' ); return false; }); }); } var slider; /*mainimg slider*/ function detectSlider() { /* var sliderMainimg = $('.bxslider'); if(sliderMainimg.length==1){ slider= sliderMainimg.bxSlider({ mode:'fade', speed:2000, fadeSpeed:3000, auto: true, //randomStart:true, startSlide:0, pager:true, controls: false, displaySlideQty: 1, moveSlideQty: 1, preloadImages: 'all', easing: 'ease' }); } */ var sliderProduct = $('.slider1'); if (sliderProduct.length == 1) { slider = sliderProduct.bxSlider({ slideWidth: 'auto', minSlides: 3, maxSlides: 7, slideMargin: 5, pager: false, infiniteLoop: false, useCSS: false }); } } function noneNavfix() { if (($(this).width() < 768 ) && ($('#navbar-fix').length == 0)) { $('#content').css('margin-top', $('#navbar-fix').height()); $('header').css('top', 0); } else { $('#content').css('margin-top', 0); $('header').css('top', 'auto'); } } jQuery(document).ready(function (e) { detectSlider(); if($.browser.version != '8.0') { $('#scroll-to-top').scrollToFixed({ bottom: 0, limit: function () { return $('#footer').offset().top - $('#scroll-to-top').height() - 10; } }); } $('.close-modal').click(function () { $('.modal').modal('hide'); // $('body').addClass('modal-open'); }); if (isUA.iphone() || isUA.android()) { //mobile mode $('#header').scrollToFixed({ top: 0 //limit: $('#header').offset().top }); if (isUA.iphone()) { $("body").addClass('ios'); } else $("body").addClass('android'); } else if (isUA.ipad()) { $("body").addClass('tablet'); $(".gNav-sub > li").on("touchstart", function (e) { var link = $(this); //preselect the link if (link.hasClass('hover')) { return true; } else { link.addClass('hover'); $('.gNav-sub > li').not(this).removeClass('hover'); e.preventDefault(); return false; //extra, and to make sure the function has consistent return points } }); $('#navbar-fix').scrollToFixed({ //marginTop: $('.gNav').height()+15, limit: $('#header').offset().top }); } else { //pc mode if($.browser.version != '8.0') { $('#navbar-fix').scrollToFixed({ //marginTop: $('.gNav').height()+15, limit: $('#header').offset().top }); } } $('.panel-footer .btn-close').click(function () { var id = $(this).attr('href'); var target = $(id).prev().attr("id"); id = id.substr(1, id.length - 1); var offset = $('#navbar-fix').height(); navigateToElement(target, offset); }); $(".catalog-list, .catalog-download").on("click", ".modal-calling", function () { var modal = $(this).data("target"); var link = modal.substr(1, modal.length - 1); link = "/product/modalcatalogs/" + link + ".html"; $.ajax({ url: link, type: 'GET' }).success(function (html) { //var modalId = $(html).attr("id"); var emptyModal = ''; if ($("#myModal").length) { } else { $(emptyModal).insertAfter("div#content"); } $("#myModal").html($(getHtmlBody(html)).html()); }).done(function (html) { //var modalId = $(html).attr("id"); $("#myModal").modal("show"); }).error(function (err) { alert(err.statusText); }); //return false; }); $("body").on("click", ".modal-calling", function () { return false; }); $("#header a[target='_blank'], #footer a[target='_blank']").click(function () { window.open($(this).attr("href")); return false; }); $(".gNav-sub").on('click','li a', function(){ $("#navbar").collapse('hide'); hashScroll(); }); }); jQuery(window).load(function (e) { $(window).on('hashchange', function () { hashScroll(); }); if (window.location.hash) { hashScroll(); } }); function hashScroll() { var hash = window.location.hash; hash = hash.substr(1, hash.length - 1); var offset = $('#navbar-fix').height(); navigateToElement(hash, offset); $("#navbar").collapse('hide'); //history.pushState("", document.title, window.location.pathname); } function navigateToElement(id, offset) { if ($("#" + id).length) { $('html, body').animate({ scrollTop: $("#" + id).offset().top - offset }, 1000); } } function getHtmlBody(str){ if (str.indexOf('') < 0) { return str; } var start_len = str.indexOf('') + 6; var last_len = str.length - str.indexOf(''); var target_len = str.length - start_len - last_len; var target_html = str.substr(start_len, target_len); return target_html; } $(window).ready(function (e) { if ($(window).width() < 768) { $('.pageTop,#navbar,#navbar-fix').removeAttr('style'); // $('.nav-02').trigger('detach.ScrollToFixed'); $('#navbar-fix').trigger('detach.ScrollToFixed'); // set height for #navbar of SP display } noneNavfix(); $('img[usemap]').rwdImageMaps(); }); $('#collapse09').on('shown.bs.collapse', function () { $('img[usemap]').rwdImageMaps(); }) function resizeSP(){ menuSpToggle(); if (typeof slider != "undefined") { slider.goToSlide(0); } if ($(this).width() < 768) { //$('#navbar').trigger('detach.ScrollToFixed'); $('#navbar-fix').trigger('detach.ScrollToFixed'); /*$('#navbar').scrollToFixed({ marginTop: 52, limit: 0 });*/ } else { if($.browser.version != '8.0') { //$('.pageTop').trigger('detach.ScrollToFixed'); $('#header').trigger('detach.ScrollToFixed'); // $('.nav-02').trigger('detach.ScrollToFixed'); $('#navbar-fix').trigger('detach.ScrollToFixed'); // $('#navbar').trigger('detach.ScrollToFixed'); $('#navbar,#navbar-fix').removeAttr('style'); // $('.pageTop,#navbar,.nav-04').removeAttr('style'); /*$('#navbar').scrollToFixed({ top: 0, limit: $('#header').offset().top });*/ $('#navbar-fix').scrollToFixed({ //marginTop: $('.gNav').height()+15, limit: $('#header').offset().top }); } // $('.nav-02').scrollToFixed({ // marginTop: $('.gNav').height()+15+$('.nav-04').height(), // limit: $('#header').offset().top // }); } noneNavfix(); text_middle(); } var timer = false, winWidth = $(window).width(), winHeight = $(window).height(); $(window).off('resize'); $(window).on('resize', function() { var winNewWidth = $(window).width(), winNewHeight = $(window).height(), onResize = function() { resizeSP(); }; // compare new height and width with old ones if(winWidth !== winNewWidth || winHeight !== winNewHeight) { if (timer !== false) { clearTimeout(timer); } timer = setTimeout(onResize, 200); } //Update the width and height winWidth = winNewWidth; winHeight = winNewHeight; }); $('#nav-tab a').click(function () { $(this).tab('show'); }) $('#ModalZoom-iframe').on('show.bs.modal', function (e) { var target = $(e.target); target.removeData('bs.modal') .find(".modal-body").html(''); }); $('#thickbox01').on('show.bs.modal', function (e) { var target = $(e.target); target.removeData('bs.modal') .find(".modal-body").html(''); }); $('#thickbox02').on('show.bs.modal', function (e) { var target = $(e.target); target.removeData('bs.modal') .find(".modal-body").html(''); }); $('#thickbox03').on('show.bs.modal', function (e) { var target = $(e.target); target.removeData('bs.modal') .find(".modal-body").html(''); }); $('#thickbox04').on('show.bs.modal', function (e) { var target = $(e.target); target.removeData('bs.modal') .find(".modal-body").html(''); }); if ($('.nivoSlider').length) { $('.nivoSlider').nivoSlider({ directionNav: false }); } $(window).on('shown.bs.modal', function () { $('body').addClass('modal-open'); }); function text_middle() { $('.btn-group-01 ul.row').each(function (index, element) { if ($(window).width() > 768) { $(this).css({'height': $(this).height()}) $(this).find('a').css({'height': $(this).height()}) } else { $(this).removeAttr('style'); $(this).find('a').removeAttr('style'); } }); } function print_visual () { if ($('.visual-01 .visual-inner').length){ var $target = $('.visual-01 .visual-inner').attr('style'); var $value = $target.replace(';', '!important;'); $('.visual-01 .visual-inner').attr('style', $value); } if ($("[class^='list-sec-']").length) { var $attr1 = $('.list-sec-01').attr('style'); $('.list-sec-01').attr('style', $attr1.replace(';', '!important;')); var $attr3 = $('.list-sec-03').attr('style'); $('.list-sec-03').attr('style', $attr3.replace(';', '!important;')); var $attr4 = $('.list-sec-04').attr('style'); $('.list-sec-04').attr('style', $attr4.replace(';', '!important;')); var $attr5 = $('.list-sec-05').attr('style'); $('.list-sec-05').attr('style', $attr5.replace(';', '!important;')); } } if($.browser.version != '8.0') { print_visual (); } var pcflag,spflag; if($(window).width() > 767){ pcflag = 1; spflag = 0; }else{ pcflag = 0; spflag = 1; } $(window).resize(function(){ if($(window).width() <= 767){ if(pcflag){ setTimeout(function(){window.location.reload()},100); pcflag = 0; spflag = 1; } }else{ if(spflag){ setTimeout(function(){window.location.reload()},100); pcflag = 1; spflag = 0; } } });