Html==========<div id= "Small" > </div>CSS===========#small {width:200px;height:200px;margin:110px auto;position:relative;} #pic {position:absolute;left:0;top:0;} JS============varSmall=document.getelementbyid (' small ');varPic=document.getelementbyid (' pic ');p Ic.onclick=function() {Act ( This,{ ' Width ': 450, ' Height ': 450, ' Left ':-50, "Top":-50 })}functioncss (obj, attr) {if(obj.currentstyle) {returnObj.currentstyle[attr]; } Else { returngetComputedStyle (obj,false) [attr]; }} functionAct (obj, JSON, fn) {clearinterval (Obj.timer); Obj.timer= SetInterval (function(){ varStop =true; for(varPinchJSON) { varValue =Json[p]; varCur =parseint (CSS (obj, p)); varSpeed = (value-cur)/8; speed= Speed > 0?Math.ceil (Speed): Math.floor (speed); if(cur! =value) {Stop=false; OBJ.STYLE[P]= cur + speed + ' px '; } } if(stop) {clearinterval (Obj.timer); Obj.timer=NULL; FN&&fn (); } }, 30); }
Change the path of the image inside the HTML
20150620 Image Click to grow