Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the animation effect of goods flying into the shopping cart with Jquery

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "Jquery how to achieve the animation effect of goods flying into the shopping cart", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "Jquery how to achieve the animation of goods flying into the shopping cart" bar!

Untitled document * {margin:0; padding:0;}. Good-area {width:200px; position:absolute; left:100px; top:50px;} .good {width:200px; height:180px; background:#ccc;}. Good img {width:100%; height:100%;}. Shop_car {width:100px; height:30px; line-height:30px; text-align:center; position:absolute; left:1000px; top:300px; background:#eee; color:red;} # add_shopcar {height:20px; line-height:20px Text-align:center; color:#03F; background:#F90;}

Join the shopping cart I am the shopping cart (function () {var shop_car=$ ('# shop_car'), carLeft=shop_car.offset (). Left, carTop=shop_car.offset (). Top / * add animation to all buy buttons * * / $('.add _ shopcar') .click (function () {var good=$ (this) .parent () .find (' .good'), goodLeft=good.offset () .left, goodTop=good.offset () .top; if (good.is (': animated')) {return } var copyGood=good.clone (); $('body') .append (copyGood); copyGood.css ({position:'absolute',left:goodLeft,top:goodTop,border:'5px # f00 solid'}); copyGood.animate ({width:80,height:80,left:carLeft,top:carTop,opacity:1}, 800 copyGood.remove function () {copyGood.remove ();}) At this point, I believe you have a deeper understanding of "Jquery how to realize the animation effect of goods flying into the shopping cart". You might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report