|
@@ -177,7 +177,6 @@ let imgXS = 0,//鼠标距离图片左侧的位置
|
|
|
drgLeft= 0,
|
|
|
tmpValL=0,
|
|
|
tmpNum=0,
|
|
|
- tmpName='',
|
|
|
tmpValR=0,
|
|
|
imgDrag = false;
|
|
|
function imgDragMove(type){
|
|
@@ -200,21 +199,20 @@ function imgDragMove(type){
|
|
|
imgWXS = wrap.offset().left;
|
|
|
imgWYS = wrap.offset().top;
|
|
|
|
|
|
- if(tmpName){
|
|
|
- if(drag.attr("src") != tmpName||drag.attr("data-deg")==0){
|
|
|
- tmpNum==0
|
|
|
- }
|
|
|
- }else{
|
|
|
- tmpName = drag.attr("src")
|
|
|
+ if(localStorage.getItem('changeImg')){
|
|
|
+ tmpNum == 0
|
|
|
+ // localStorage.setItem("changeImg",false)
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- if(tmpNum == 0){
|
|
|
- tmpValL = imgDXS-imgWXS;
|
|
|
- tmpValR = imgDYS-imgWYS;
|
|
|
- tmpName =
|
|
|
- ++tmpNum
|
|
|
- }
|
|
|
+ // if(tmpNum == 0){
|
|
|
+ // tmpValL = imgDXS-imgWXS;
|
|
|
+ // tmpValR = imgDYS-imgWYS;
|
|
|
+ // ++tmpNum
|
|
|
+ // }
|
|
|
+
|
|
|
console.log(imgDXS,imgWXS,tmpNum,'hahaha')
|
|
|
+
|
|
|
$(document).on('mousemove',handleMoveImg)
|
|
|
$(document).on('mouseup',handleUpImg)
|
|
|
})
|
|
@@ -235,44 +233,44 @@ function handleMoveImg(event){
|
|
|
let wrapHeight = drag[0].offsetHeight;
|
|
|
if(imgDrag){
|
|
|
|
|
|
- console.log('鼠标左:'+page.boxLeft)
|
|
|
- console.log('鼠标图左:'+imgXS)
|
|
|
- console.log('容器左:'+imgWXS)
|
|
|
- console.log('被拖图左:'+drag.offset().left)
|
|
|
- console.log('bian1:'+tmpValL)
|
|
|
- console.log('bian2:'+tmpValR)
|
|
|
+ // console.log('鼠标左:'+page.boxLeft)
|
|
|
+ // console.log('鼠标图左:'+imgXS)
|
|
|
+ // console.log('容器左:'+imgWXS)
|
|
|
+ // console.log('被拖图左:'+drag.offset().left)
|
|
|
+ // console.log('bian1:'+tmpValL)
|
|
|
+ // console.log('bian2:'+tmpValR)
|
|
|
|
|
|
imgDXS = page.boxLeft - imgXS - imgWXS;//相对于父元素定位
|
|
|
imgDYS = page.boxTop - imgYS - imgWYS;
|
|
|
|
|
|
- // if(wrapHeight > wrapWidth){
|
|
|
- // drag.css({
|
|
|
- // width:wrapWidth+'px',
|
|
|
- // height:wrapHeight+'px',
|
|
|
- // marginLeft:'0px',
|
|
|
- // marginTop:'0px',
|
|
|
- // left:imgDXS+(de?163:0) + 'px',
|
|
|
- // top:imgDYS-(de?163:0) + 'px'
|
|
|
- // })
|
|
|
- // }
|
|
|
- // else{
|
|
|
- // drag.css({
|
|
|
- // width:wrapWidth+'px',
|
|
|
- // height:wrapHeight+'px',
|
|
|
- // marginLeft:'0px',
|
|
|
- // marginTop:'0px',
|
|
|
- // left:imgDXS-(de?163:0) + 'px',
|
|
|
- // top:imgDYS+(de?163:0) + 'px'
|
|
|
- // })
|
|
|
- // }
|
|
|
- drag.css({
|
|
|
- width:wrapWidth+'px',
|
|
|
- height:wrapHeight+'px',
|
|
|
- marginLeft:'0px',
|
|
|
- marginTop:'0px',
|
|
|
- left:imgDXS-(de?tmpValL:0) + 'px',
|
|
|
- top:imgDYS+(de?tmpValL:0) + 'px'
|
|
|
- })
|
|
|
+ if(wrapHeight > wrapWidth){
|
|
|
+ drag.css({
|
|
|
+ width:wrapWidth+'px',
|
|
|
+ height:wrapHeight+'px',
|
|
|
+ marginLeft:'0px',
|
|
|
+ marginTop:'0px',
|
|
|
+ left:imgDXS+(de?tmpValL:0) + 'px',
|
|
|
+ top:imgDYS-(de?tmpValL:0) + 'px'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ drag.css({
|
|
|
+ width:wrapWidth+'px',
|
|
|
+ height:wrapHeight+'px',
|
|
|
+ marginLeft:'0px',
|
|
|
+ marginTop:'0px',
|
|
|
+ left:imgDXS-(de?tmpValR:0) + 'px',
|
|
|
+ top:imgDYS+(de?tmpValR:0) + 'px'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // drag.css({
|
|
|
+ // width:wrapWidth+'px',
|
|
|
+ // height:wrapHeight+'px',
|
|
|
+ // marginLeft:'0px',
|
|
|
+ // marginTop:'0px',
|
|
|
+ // left:imgDXS-(de?tmpValR:0) + 'px',
|
|
|
+ // top:imgDYS+(de?tmpValR:0) + 'px'
|
|
|
+ // })
|
|
|
}
|
|
|
}
|
|
|
module.exports = {
|