Code
$ (". Cart-increase") is the Add button
Domshopcart Shopping Cart Dom
functionBindevent () {$ (". Cart-increase"). On ("click",function(){ var__this = $ ( This); varNstartx =__this.offset (). Left, Nstarty=__this.offset (). Top, Nendx= Domshopcart.offset (). Left + DOMSHOPCART[0].OFFSETWIDTH/2, Nendy =Domshopcart.offset (). Top, Ntopx= nEndX-10, Ntopy= NEndY-8; varx = Nstartx,y =Nstarty; //Create a new content varDomgood = document.createelement (' div '); DomGood.style.width= ' 0.28rem '; DomGood.style.height= ' 0.28rem '; DomGood.style.background= ' #75d8bc '; DomGood.style.borderRadius= ' 50% '; DomGood.style.position= ' absolute '; DomGood.style.left= Nstartx + ' px '; DomGood.style.top= Nstarty + ' px '; Document.body.appendChild (Domgood); varA =-((nstarty-nendy) * (NSTARTX-NTOPX)-(nstarty-ntopy) * (NSTARTX-NENDX))/((NSTARTX * nstartx-nendx * nendx ) * (NSTARTX-NTOPX)-(NSTARTX * NSTARTX-NTOPX * ntopx) * (Nstartx-nendx)); varB = ((Nendy-nstarty)-A * (NENDX * nendx-nstartx * nstartx))/(Nendx-nstartx); varc = nstarty-a * NSTARTX * nstartx-b *Nstartx; varTimer = SetInterval (function () { /*y = A * x*x + b*x +c;*/ if(X >nendx) {x= x-10; Y= A * x * x + b * x +C; DomGood.style.left= x + ' px '; DomGood.style.top= y + ' px '; }Else{domGood.parentNode.removeChild (Domgood); Clearinterval (timer); varEle = domshopcart[0]; Domshopcart.css ({"Transform": "Scale (1.2)"}); SetTimeout (function() {domshopcart.css ({"Transform": "Scale (1)"}); },100) } }, 20); }); }
Shopping Cart Parabolic