function quick_view_load(type,top){ if(type == 'show'){ $("body").append("
"); $("#quick_view_loading").css({"left": $(document).width()/2 - (126/2), "top": top, "font-size":"15px", "text-align":"center", "position": "absolute" }); } else{ $("#quick_view_loading").remove(); } } $(document).ready(function(){ //預覽按鈕 $(".preview_imgs").mouseover(function(e){ var imgLeft = $(this).offset().left + 11; var imgTop = $(this).offset().top + $(this).height() - 24 - 11; var SendStr = $(this).attr('SendStr'); $("#quick_preview_imgs_div").remove(); $("body").append("
"); $("#quick_preview_imgs_div").css({"left": imgLeft, "top": imgTop, "text-align":"center", "position": "absolute" }); $(".edit_order_car").css({"opacity":"0.9", "cursor":"pointer" }); $(".edit_order_car").hover( function(e){ $(this).attr('src','/products/images/preview_over.jpg'); e.stopPropagation(); }, function(e){ $(this).attr('src','/products/images/preview.jpg'); e.stopPropagation(); } ); e.stopPropagation(); }); //快速預覽 $(".edit_order_car").live("click",function(){ var SendStr = $(this).attr('SendStr'); var left = $(this).offset().left; var top = $(this).offset().top; $(this).ui_setmask({ dotype: "mask", maskColor: "#333333", opacity: "0.3" }); var myscrollTop = $(document).scrollTop(); var boxWidth = 438; var boxHeight =420; $("body").append("
"); $("#edit_order_car_Div").css({ "position": "absolute", "left": $(document).width()/2 - boxWidth/2, "top": myscrollTop + boxHeight/2 }).hide(); $.ajax({ type: "post", url: "/products/preview.php", data: SendStr , context: $("#edit_order_car_Div"), success: function(html){ $(this).html(html).fadeIn(); $(document).scrollTop(myscrollTop); } }); }); //變換顏色 $(".color_default").live("click",function(){ var SendStr = $(this).attr('SendStr'); var theTop = $("#edit_order_car_Div").offset().top - 22; quick_view_load('show',theTop); $.ajax({ type: "POST", url: "/products/preview.php", context: $("#edit_order_car_Div"), data: SendStr, success: function(html){ quick_view_load('remove',''); $(this).html(html); } }); }); //變換尺寸 $(".color_size_default a").live("click",function(){ var SendStr = $(this).attr('SendStr'); var theTop = $("#edit_order_car_Div").offset().top - 22; quick_view_load('show',theTop); $.ajax({ type: "POST", url: "/products/preview.php", context: $("#edit_order_car_Div"), data: SendStr, success: function(html){ quick_view_load('remove',''); $(this).html(html); } }); }); //關閉快速預覽 $(".cancel_eidt_car").live("click",function(){ $("#edit_order_car_Div").remove(); $("#SizeTb_Div").remove(); $(".edit_order_car").ui_setmask({dotype:"unmask"}); }); //觀看尺寸表 $(".Look_SizeTb").live("click",function(){ var SendStr = $(this).attr('SendStr'); var left = $(this).offset().left; var top = $(this).offset().top; $("body").append("
"); $("#SizeTb_Div").css({ "position":"absolute", "left":(left-450), "top":(top-15), "z-index":50 }); $.ajax({ type: "get", url: "/products/include/size.php", data: SendStr , context: $("#SizeTb_Div"), success: function(html){ $(this).html(html).fadeIn(); } }); }); //加入購物車 $(".Add_To_Order_Car").live("click",function(){ if($(this).attr("selectSize") == ""){ alert("請先選擇尺寸!"); return } var amount = $("select[name='Amount']").val(); var SendStr = "&send=Add" + $(this).attr('SendStr') + "&amount=" + amount + "&per=1"; $.ajax({ type: "POST", url: '/ajax_php/order_car-p.php', dataType:"json", data: SendStr, async: false, success: function(returnJsonObj){ $(".cancel_eidt_car").trigger("click"); if(returnJsonObj.Msg){//有訊息 //alert(returnJsonObj.Msg); //if(returnJsonObj.act)eval(returnJsonObj.act); dialog_msg(returnJsonObj.Msg, returnJsonObj.act) } else{ if(returnJsonObj.act)eval(returnJsonObj.act); } } }); }); //觀看大圖 $("#LookBigPic").live("click",function(){ var boxWidth = 790; //var boxHeight =711; var url_value = $(this).attr('SendStr'); $(this).ui_setmask({ dotype: "mask", maskColor: "#333333", opacity: "0.8" }); $("body").append("
"); $("#LookBigPic_Div").css({ "position": "absolute", "left": $(document).width()/2 - boxWidth/2, "top": $(document).scrollTop() + 70, "background-color":"#FFF", "z-index": "5001" }); $.ajax({ type: "post", url: "/products/picture.php", data: url_value , context: $("#LookBigPic_Div"), timeout: 5000, success: function(html){ $(this).css("border","2px solid #36F").html(html).fadeIn(); } }); }); $(document).mouseover(function(){ $("#quick_preview_imgs_div").hide(); }); });