前端之家收集整理的这篇文章主要介绍了
jQuery实现360°全景拖动展示,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
unitStep){
if(mmx-mdx>0){
current=current+1;
}else{
current=current-1;
}
mdx=mmx;
if(current<0)current=length-1;
if(current>length-1)current=0;
that.attr("src",images[current]);
}
}
}).on('touchend',function(e){
isDrag=false;
});
//拖动
that.on('mousedown',function(e){
mdx=e.pageX;
isDrag=true;
}).on('mousemove',function(e){
mmx=e.pageX;
if(isDrag){
if(Math.abs(mmx-mdx)>unitStep){
current=current+(mmx-mdx>0?1:-1);
mdx=mmx;
if(current<0)current=length-1;
if(current>length-1)current=0;
that.attr("src",images[current]);
}
}
return false;
})
$(document).on('mouseup',function(e){
isDrag=false;
});
$(document).on('mouseleave',function(e){
isDrag=false;
});
return this;
};
})(jQuery);