/* 圖片移動檢視 (商品詳細頁) (推薦商品) */ var movePhotoShow2 = function(hs){ var index = 1; var ids = new Array(); var total = Math.ceil($("#" + hs.ul).children('li').size() / hs.num); if(total <= 1){ $("#" + hs.div).find("#" + hs.left).hide(); $("#" + hs.div).find("#" + hs.right).hide(); } $("#" + hs.ul).children('li').each(function(){ ids.push($(this).attr('Card_Prod_Sell_ID')); }); this.init = function(){ $("#" + hs.div).find("#" + hs.left).click(function(){ if(index <= 1){ return; } else{ index--; $("#Card_Prod_Sell_ID").val(ids[index - 1]); $("#" + hs.ul).animate({ "left": "+=" + hs.width }); }; }); $("#" + hs.div).find("#" + hs.right).click(function(){ if(index >= total){ return; } else{ $("#Card_Prod_Sell_ID").val(ids[index]); index++; $("#" + hs.ul).animate({ "left": "-=" + hs.width }); }; }); }; }; var movePhotoShow1 = function(hs){ var index = 1; var total = Math.ceil($("#" + hs.ul).children('li').size() - hs.num + 1 ); if(total <= 1){ $("#" + hs.div).find("#" + hs.left).hide(); $("#" + hs.div).find("#" + hs.right).hide(); } this.init = function(){ $("."+hs.mouse).hover( function(){ $(this).children("img").show(); },function(){ $(this).children("img").hide(); } ); $("#" + hs.div).find("#" + hs.left).click(function(){ if(index <= 1){ return; } else{ index--; $("#" + hs.ul).animate({ "top": "+=" + hs.height }); }; }); $("#" + hs.div).find("#" + hs.right).click(function(){ if(index >= total){ return; } else{ index++; $("#" + hs.ul).animate({ "top": "-=" + hs.height }); }; }); }; }; var movePhotoShow = function(hs){ var index = 1; var total = Math.ceil($("#" + hs.ul).children('li').size() / hs.num); /* if(total <= 1){ $("#" + hs.div).find("#" + hs.left).hide(); $("#" + hs.div).find("#" + hs.right).hide(); } */ this.init = function(){ $("#" + hs.div).find("#" + hs.left).click(function(){ if(index <= 1){ return; } else{ index--; $("#" + hs.ul).animate({ "left": "+=" + hs.width }); }; }); $("#" + hs.div).find("#" + hs.right).click(function(){ if(index >= total){ return; } else{ index++; $("#" + hs.ul).animate({ "left": "-=" + hs.width }); }; }); }; }; /* 點擊小圖更換大頭 (商品詳細頁) (推薦商品) */ var clickPhotoShow = function(hs){ this.init = function(){ $("."+hs.clicked).click(function(){ var src = hs.url + $(this).attr("the_url"); $("."+hs.lfocus).removeClass().addClass(hs.ldefalut); $(this).parent().removeClass().addClass(hs.lfocus); $("."+hs.div).children("img").attr("src",src); }); }; };