var d2_273459695_2a19zOut_imgArr=new Array(http://res.mynet.cn/res/plugin/smartphotoalbum/res/l_gray.jpg,http://res.mynet.cn/res/plugin/smartphotoalbum/res/r_gray.jpg,http://res.mynet.cn/res/plugin/smartphotoalbum/res/l_blue.jpg,http://res.mynet.cn/res/plugin/smartphotoalbum/res/r_blue.jpg);
var d2_273459695_2a19zOut_j=[
{
itemID: picitem0,
itemPhotoSrc:http://a531310061.oinsite.yh.mynet.cn/_m_gw_yqnvZxsIrrq9KAC-7TKGEOfF46ebDITJt9mtVU2dtY_nMHLK7I7Tlvhr4AldPhTmLk0-vbg-7yYASBYv3ZJlfd4w5YPrSL9Mmjtl0EhWs6owVVn5f383Vg==.jpg,
smallPhotoSrc:http://a531310061.oinsite.yh.mynet.cn/_m_gw_yqnvZxsIrrq9KAC-7TKGECHpcgVsz1Uyzhv54Z2siVrUV4Y5Ejk_I0NiP7k5ifiugkJVcrNNVF4U-6Nkom6bRgdBOr7ZDdfKsBXcxIiBH3bxlykwLPYsKk9tImmYhH5n.jpg,
bigPhotoSrc:http://a531310061.oinsite.yh.mynet.cn/_m_gw_yqnvZxsIrrq9KAC-7TKGEGLgsEQMARwYtpMJhHRpGY0W3n1v-_TyOZ6CYeu6NrGWYKUchWzwNWj9waOVDTzVsYYTWZv7sCzmcScmCmHyRpCMxN6iFba5P6qr_XynyXG2.jpg,
realPhotoSrc:http://a531310061.oinsite.yh.mynet.cn/_m_gw_yqnvZxsIrrq9KAC-7TKGEHOWrQWKuGSmhqQ7dm1gw8aoWOGA_swEH_m4SJ-OFvuqSEijotlsIctj8g1Mg1vCwvh0KwoeISahpAEE_3yJGnWCup72poh4ew==.jpg,
title:,
url:
}
];
|
|
(function($){$.fn.jqueryzoom=function(options){var settings={xzoom:200,yzoom:200,offset:10,position:right,lens:1,preload:1};if(options){$.extend(settings,options)}var noalt=;function IsPosInRect(x,y,left,top,width,height){return((x>left&&x
top&&yr2_x+r2_w)pt.x=r2_x+r2_w-r1_w;if(r1_y+r1_h>r2_y+r2_h)pt.y=r2_y+r2_h-r1_h;return pt}var zooming=false;var imgSrcArr=[];function hasCacheSrc(SRC){for(var i=0;i);imgSrcArr.push(imgSrc)}$(div.zoomdiv).remove()};$(this).children(img).hover(function(){var hoverImage=$(this);var imageLeft=hoverImage.offset().left;var imageTop=hoverImage.offset().top;var imageWidth=hoverImage.width();var imageHeight=hoverImage.height();noalt=hoverImage.attr(alt);var bigimage=hoverImage.attr(jqimg);hoverImage.attr(alt,);if($(div.zoomdiv).get().length==0){$(body).append();$(body).append( )}var leftpos=imageLeft+imageWidth+10;$(div.zoomdiv).css({top:imageTop,left:leftpos});settings.xzoom=imageWidth;settings.yzoom=imageHeight;$(div.zoomdiv).width(settings.xzoom);$(div.zoomdiv).height(settings.yzoom);$(div.zoomdiv).show();if(!settings.lens){$(this).css(cursor,crosshair)}$(div.jqZoomPup).mouseout(function(){HoverEnd()});HoverStart(imageLeft,imageTop,imageWidth,imageHeight)},function(){})}})(jQuery);function MouseEvent(e){this.x=e.pageX;this.y=e.pageY};
function sbuilder(value){this.strings=new Array();this.append(value)};sbuilder.prototype.append=function(value){if(value){this.strings.push(value)}};sbuilder.prototype.clear=function(){this.strings.length=1};sbuilder.prototype.toString=function(splitter){var _sp=splitter?splitter:;return this.strings.join(_sp)};sbuilder.prototype.appendFormat=function(){var args=arguments;var templatestr=args[0];templatestr=templatestr.replace(new RegExp(\\{(\\d+)\\},gm),function(m,i){return args[++i]});this.strings.push(templatestr)}
$(document).ready(function(){
$(.jqzoom).jqueryzoom({ xzoom:300, yzoom:300, offset:5, position:right });
var _locArr = d2_273459695_2a19zOut_j;
var _locArrRL = d2_273459695_2a19zOut_imgArr;
var _cacheSpicArr =[];
var j_container,j_items,itemStyle,j_spic,j_curr_json_item,j_curr_item,j_curr_item_id,j_seeoripic,j_leftbtn,j_rightbtn;
j_container = $(#subItmed2_273459695_2a19zOut_);
var j_itemsCount = j_container.find(div).size(); //Item图片容器
j_leftbtn = $(#leftbtnd2_273459695_2a19zOut_);
j_rightbtn = $(#rightbtnd2_273459695_2a19zOut_);
var itemScale ={start:0,end:j_itemsCount-1};
if(j_itemsCount<_locArr.length){
var sb = new sbuilder();
var templateHTML = ;
itemStyle = j_container.find(div).attr(style);
for(var i=j_itemsCount;i<_locArr.length;i++){
var item = _locArr[i];
sb.appendFormat(templateHTML,itemStyle+;display:none,item.itemID, item.itemPhotoSrc);
}
$(sb.toString()).insertBefore(j_rightbtn);
}
j_items = j_container.find(div);
j_spic = $(#spicd2_273459695_2a19zOut_); //小图 , 原图装载在 json 里面 通过 点击window open
j_seeoripic = $(#seeoripicd2_273459695_2a19zOut_); // 查看原图
//左右单击 考虑到 j_curr_item // 左右btn enable disable 应该在 click 中考虑
j_leftbtn.click(function(){
var nid = parseInt( j_curr_item_id.replace(picitem,));
if(nid==0) {
itemScale ={start:0,end:j_itemsCount-1};
return;
}
if(nid == itemScale.start){
$(#picitem+itemScale.end).hide();
itemScale.start = itemScale.start-1 ;
itemScale.end = itemScale.end-1 ;
$(#picitem+itemScale.start).show();
}
j_curr_item.prev().click();
}) ;
j_rightbtn.click(function(){
var nid = parseInt( j_curr_item_id.replace(picitem,));
if(nid == _locArr.length-1){
itemScale ={start: _locArr.length - j_itemsCount ,end:_locArr.length-1};
return;
}
if(nid == itemScale.end){
$(#picitem+itemScale.start).hide();
itemScale.start = itemScale.start+1 ;
itemScale.end = itemScale.end+1 ;
$(#picitem+itemScale.end).show();
var img = $(#picitem+itemScale.end).find(img);
img.attr(src,img.attr(strSrc));
}
j_curr_item.next().click();
});
//查看原图
j_seeoripic.css(cursor,pointer).click(function(){
if(!j_curr_json_item){
j_curr_json_item= _locArr[0];
}
window.open(j_curr_json_item[realPhotoSrc]);
});
//item图片click 切换小图,大图 ,原图需要在上面的方法click时 去访问curr_json_item
j_items.click(function(){
var idx =$(this).attr(id);
j_curr_json_item = getPicItem(idx);
j_curr_item_id = idx;
if(j_curr_json_item){
var s_pic_src = j_curr_json_item[smallPhotoSrc];
var b_pic_src = j_curr_json_item[bigPhotoSrc];
var o_pic_src = j_curr_json_item[realPhotoSrc];
if( j_spic.attr(src) == s_pic_src)
{
j_curr_item = $(this); j_curr_item_id = idx;
j_container.children(div).css(border,solid 1px gray);
j_curr_item.css(border,solid 1px red);
return ; // 当前item链接 与小图链接一致 不需要改变url
}
j_spic.attr(src,s_pic_src);
j_spic.attr(jqimg,b_pic_src);
if(!spicInCache(s_pic_src)){
$(document.body).append();
}
j_curr_item = $(this); j_curr_item_id = idx;
j_container.children(div).css(border,solid 1px gray);
j_curr_item.css(border,solid 1px red);
}
var nid = parseInt(j_curr_item_id.replace(picitem,));
switch(nid){
case 0 : j_leftbtn.attr(src , _locArrRL[0] ); j_rightbtn.attr(src , _locArrRL[3]); break;
case _locArr.length-1 : j_leftbtn.attr(src , _locArrRL[2] ); j_rightbtn.attr(src , _locArrRL[1]); break;
default: j_leftbtn.attr(src , _locArrRL[2] ); j_rightbtn.attr(src , _locArrRL[3]) ; break;
}
});
$(j_items.get(0)).click();
function getPicItem(itemID){
for(var i=0;i<_locArr.length;i++){
if( _locArr[i].itemID == itemID){
return _locArr[i];
}
}
}
function spicInCache(spicSrc){
for(var i=0;i<_cacheSpicArr.length;i++){
if( _cacheSpicArr[i] == spicSrc){
return true;
}
}
return false;
}
});