// JavaScript Document /*=========================== 【判斷寬度】 ===========================*/ var standardUIMin = 960; var iPadUIMin = 768; var iPhoneUIMax = 480; var iPhoneUIMin = 320; function w(){ var windowWidth = $(window).width(); var windowHeight = $(window).height(); if(windowWidth >= 1930){ $('#wrap').css('height',windowHeight); } else if(windowWidth >= standardUIMin){ $('body').attr('class', 'standardUIMin'); //$(".hdr img").attr("src","theme/tw/images/header/item_hdr.jpg"); $("#abus-pc").show();$("#abus-phone").hide(); $('#wrap').css('height','auto'); } else if(windowWidth >= iPadUIMin){ $('body').attr('class', 'ipadUI'); //$(".hdr img").attr("src","theme/tw/images/header/item_hdr.jpg"); $(".gopath span").show();$(".gopath span:first").attr('class', 'fst');$(".gopath span:last").attr('class', 'last'); $("#abus-pc").show();$("#abus-phone").hide(); $('#wrap').css('height','auto'); } else if(windowWidth >= iPhoneUIMax){ $('body').attr('class', 'iphoneUI iphoneUIMax'); //$(".hdr img").attr("src","theme/tw/images/header/item_hdr.jpg"); $(".gopath span").hide();$(".gopath span:last").show().attr('class', 'fst last'); $("#abus-pc").show();$("#abus-phone").hide(); $('#wrap').css('height','auto'); } else if(windowWidth >= iPhoneUIMin){ $('body').attr('class', 'iphoneUI'); //$(".hdr img").attr("src","theme/tw/images/header/item_hdr-s.jpg"); $(".gopath span").hide();$(".gopath span:last").show().attr('class', 'fst last'); $("#abus-pc").hide();$("#abus-phone").show(); $('#wrap').css('height','auto'); } else{ $('body').attr('class', 'noCss'); $('#wrap').css('height','auto'); //$(".hdr img").attr("src","theme/tw/images/header/item_hdr-s.jpg"); } } $(window).resize(function(e){ w(); }); $(function(){ if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { window.addEventListener("load",function() { setTimeout(function(){ window.scrollTo(0, 1); }, 10); }); $('.hdr video').hide(); $('.hdr_bg').show(); } else if (navigator.userAgent.match(/android/i)) { $('.hdr video').hide(); $('.hdr_bg').show(); } else if (eval(parseInt($.browser.version))<=8) { $('.hdr video').hide(); $('.hdr_bg').show(); } else { $('.hdr video').show(); $('.hdr_bg').hide(); } w(); var lang = 'tw'; var os = navigator.platform; if(lang=='tw') { if (os.indexOf("Mac") != -1) { $('body').css( 'font-family', '""' ); } else if (os.indexOf("Win") != -1) { $('body').css( 'font-family', '"微軟正黑體"' ); } } else if(lang=='cn') { $('body').css( 'font-family', '"微软雅黑"' ); } else if(lang=='en') { $('body').css( 'font-family', '"arial"' ); } else if(lang=='jp') { $('body').css( 'font-family', 'Meiryo,Osaka,"MS Pゴシック"' ); } if(navigator.platform.toUpperCase().indexOf('WIN')!==-1){ }else if(navigator.platform.toUpperCase().indexOf('MAC')!==-1){ } /*=========================== 【首頁主選單】 ===========================*/ $('.menu li').hover(function(){ $(this).addClass('hv'); $(this).find('.submenu').stop(true, true).fadeIn(400); } , function(){ $(this).removeClass('hv'); $(this).find('.submenu').stop(true, true).delay(200).fadeOut(400); }); $('.i-menu').click(function(){ $(this).toggleClass('on'); $('.phone ul').stop(true, true).slideToggle(); }); /*=========================== 【FancyBox】 ===========================*/ $('.fancybox').fancybox({ 'padding':0,'maxWidth':900 }); /*=========================== 【最新消息列表】 ===========================*/ $('.list01 li').hover(function(){ $(this).addClass('hv'); } , function(){ $(this).removeClass('hv'); }); /*=========================== 【responsive-ulli-float】 ===========================*/ var t=$('.masonry'); t.masonry({ itemSelector:'.masonry li', isResizable:true, columnWidth:10 }) /*=========================== 【搜尋結果列表】 ===========================*/ $('.list03 li').hover(function(){ $(this).addClass('hv'); $(this).find('.subsearch').stop(false, true).fadeIn(); } , function(){ $(this).removeClass('hv'); $(this).find('.subsearch').stop(false, true).fadeOut(); }); /*=========================== 【頁籤表單】 ===========================*/ $('.tablist li').click(function() { var $this = $(this), _clickTab = $this.find('a').attr('href'); $this.addClass('on').siblings('.on').removeClass('on'); $(_clickTab).stop(false, true).fadeIn().siblings().hide(); return false; }).find('a').focus(function(){ this.blur(); }); /*=========================== 【返回頂端】 ===========================*/ $('#bodytop').click(function() { $('body,html').animate({scrollTop:0},800); }); $('#divtop').click(function() { if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { $('body,html').animate({scrollTop:$('.basic-info').offset().top-50},800); } else { $('.fancybox-overlay').animate({scrollTop:0},800); } }); });