') .attr({'id':'hide_box'}) .append( $('') .text('加入中') ) );*/$.ajax({ type: "POST", url: "/ajax_cart/get_amount", data: 'product_id='+product_id, dataType:'json', success: function(info) { if(info.result){if(parseInt(info.amount) < 10){amount = parseInt(info.amount)+1;}else{parseInt(info.amount)+1;}}if(amount > 0) {ajax_add_cart(1, 0, category_id, product_id, spec_id, amount, is_msg, pay_type);} else {alert('請選擇數量');} return(false); } });}function gotop(){ $("html,body").animate({ scrollTop: 0 }, 900); return false;}function seecar(){ alert('您尚未選購商品');}$(function() { /* 登入 */ $('#sign_in_block').hide(); $('.sign_in_btn, #btn_g_sty').click(function() { $('#sign_in_block').show(); $('#sign_in_block').css('display', 'block'); $('.cart_btn').removeClass('active'); }); $('.sign_in_hide').click(function() { $('#sign_in_block').hide(); $('#sign_in_block').css('display', 'none'); $('.show_sign_in').fadeIn(); $('.show_forget_psw').fadeOut(); }); /* 登出 */ $('#sign_out').click(function() { /*alert("成功登出");*/ return confirm('您確定要登出嗎?'); }); /* 忘記密碼燈箱 */ $('.forget_psw_btn').click(function(){ $('.show_sign_in').fadeToggle(); $('.show_forget_psw').fadeToggle(); }); /* 註冊 */ var cart_num = parseInt($("#cart_num").text()); if (cart_num <= 0) { $('.sign_prompt_n').show(); $('.sign_prompt_y').hide(); } else { $('.sign_prompt_y').show(); $('.sign_prompt_n').hide(); } /* 購物車區塊 */ $('.cart_btn').hover( function() { $('.cart_btn').addClass('active'); }, function() { $('.cart_btn').removeClass('active'); } ); $('#continue_shopping').click(function() { $('.cart_btn').removeClass('active'); }); /* 控制購物車有產品時不要去結帳頁面*/ $('#cart_mobile_link').click(function(e) { if($('span.cart_num').text() == 0) { e.preventDefault();/* alert('您尚未選購產品');location.reload();*/ } }); /*表單驗證*/ $('#validation-login-form').validate({ errorElement: 'label', errorClass: 'error', focusInvalid: false, ignore: '', rules: { account: { required: true }, password: { required: true }, captcha: { required: true } }, errorPlacement: function(error, element) { if (element.is('input[type=checkbox]') || element.is('input[type=radio]')) { var controls = element.closest('div[class*="col-"]'); if (controls.find(':checkbox,:radio').length > 1) controls.append(error); else error.insertAfter(element.nextAll('.lbl:eq(0)').eq(0)); } else error.insertAfter(element.parent()); }, submitHandler: function(form) { loginbyGeneral(form, 'pc'); } });$('#header_forget_pwd_form').validate({ errorElement: 'label', errorClass: 'error', focusInvalid: false, ignore: '', rules: { email: { required: true,email: true }, }, errorPlacement: function(error, element) { if (element.is('input[type=checkbox]') || element.is('input[type=radio]')) { var controls = element.closest('div[class*="col-"]'); if (controls.find(':checkbox,:radio').length > 1) controls.append(error); else error.insertAfter(element.nextAll('.lbl:eq(0)').eq(0)); } else error.insertAfter(element.parent()); }, submitHandler: function(form) {if(typeof(grecaptcha) == 'object' && grecaptcha.getResponse(recaptcha2) == ''){alert('請勾選我不是機器人驗證');}else{$('#header_forget_pwd_form').attr('disabled', 'disabled');form.submit();} } });});function search_check(obj, e) { if ($(obj).find('input[name="search_val"]').val().length == 0) { alert('請輸入查詢之關鍵字'); e.preventDefault(); }}$(function () {$('#index-banner').flexslider({animation : 'slide',controlNav : true,directionNav :false,animationLoop : true,slideshow : true,pauseOnHover:true,useCSS : false});$('.flexslider').flexslider({animation : 'slide',controlNav : false,directionNav : true,animationLoop : true,slideshow : true,pauseOnHover:true,useCSS : false});});/* 置頂選單 */$(window).scroll(function () { if ($(this).scrollTop() > 160) { $('#header').addClass("menufixed"); $('#header-right').addClass("menufixed-right"); } else { $('#header').removeClass("menufixed"); $('#header-right').removeClass("menufixed-right"); }}); var swiper = new Swiper('.newindex-ban .swiper-container', {slidesPerView: 1,spaceBetween: 0,loop: true,autoplay: {delay: 5000,},pagination: {el: '.newindex-ban .swiper-pagination',clickable: true,},});var swiper = new Swiper('.index-blogphone .swiper-container', {slidesPerView: 1,spaceBetween: 10,loop: true,pagination: {el: '.index-blogphone .swiper-pagination',clickable: true,},});var swiper = new Swiper('.index-newphone .swiper-container', {slidesPerView: 1,spaceBetween: 10,loop: true,pagination: {el: '.index-newphone .swiper-pagination',clickable: true,},});var swiper = new Swiper('.index-specialph .swiper-container', {slidesPerView: 1,spaceBetween: 10,loop: true,navigation: {nextEl: '.index-specialph .swiper-button-next',prevEl: '.index-specialph .swiper-button-prev',},pagination: {el: '.index-specialph .swiper-pagination',clickable: true,},});var swiper = new Swiper('.index-viewphone .swiper-container', {slidesPerView: 1,spaceBetween: 10,loop: true,navigation: {nextEl: '.index-viewphone .swiper-button-next',prevEl: '.index-viewphone .swiper-button-prev',},pagination: {el: '.index-viewphone .swiper-pagination',clickable: true,},});var swiper = new Swiper('.index-project-swiper .swiper-container', {slidesPerView: 1,spaceBetween: 10,loop: true,navigation: {nextEl: '.index-project-swiper .swiper-button-next',prevEl: '.index-project-swiper .swiper-button-prev',},pagination: {el: '.index-project-swiper .swiper-pagination',clickable: true,},});if($('.index-viewpc .swiper-container').length > 0) {var num = $('.gallery-top').find('.swiper-slide').length;if(num > 7) {var galleryTop = new Swiper('.gallery-top', {loop: true,loopedSlides: num,navigation: {nextEl: '.index-viewpc .swiper-button-next',prevEl: '.index-viewpc .swiper-button-prev',},});var galleryThumbs = new Swiper('.gallery-thumbs', {slidesPerView: 8,loop: true,loopedSlides: num,centeredSlides: true,slideToClickedSlide: true,});} else {var galleryTop = new Swiper('.gallery-top', {navigation: {nextEl: '.index-viewpc .swiper-button-next',prevEl: '.index-viewpc .swiper-button-prev',},});var galleryThumbs = new Swiper('.gallery-thumbs', {centeredSlides: true,slidesPerView: 'auto',slideToClickedSlide: true,});}galleryTop.controller.control = galleryThumbs;galleryThumbs.controller.control = galleryTop;};/* 搜尋關鍵字送出 */function search_keyword(topic) {$('#formkeyta_pc').find('input[name=search_type]').val('keyword');$('#formkeyta_pc').find('input[name=search_val]').val(topic);$('#formkeyta_pc').submit();}