jquery实现添加购物车动画
代码语言:html
所属分类:动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.min.css" integrity="sha256-+N4/V/SbAFiW1MPBCXnfnP9QSN3+Keu+NlB+0ev/YKQ=" crossorigin="anonymous" /> <style> html, body { height: 100%; min-height: 100%; font-family: "Helvetica Neue","Helvetica","Arial",sans-serif; } *, *:before, *:after { box-sizing: border-box; } .page-wrapper { min-height: 100%; display: flex; align-items: center; justify-content: center; } .page-wrapper button { padding: 20px; border: none; background: #d5d8e7; position: relative; outline: none; border-radius: 5px; color: #292d48; font-size: 18px; } .page-wrapper button .cart-item { position: absolute; height: 24px; width: 24px; top: -10px; right: -10px; } .page-wrapper button .cart-item:before { content: '1'; display: block; line-height: 24px; height: 24px; width: 24px; font-size: 12px; font-weight: 600; background: #2bd156; color: white; border-radius: 20px; text-align: center; } .page-wrapper button.sendtocart .cart-item { display: block; animation: xAxis 1s forwards cubic-bezier(1, 0.44, 0.84, 0.165); } .page-wrapper button.sendtocart .cart-item:before { animation: yAxis 1s alternate forwards cubic-bezier(0.165, 0.84, 0.44, 1); } .cart { position: fixed; top: 20px; right: 20px; width: 50px; height: 50px; background: #292d48; display: flex; align-items: center; justify-content: center; border-radius: 5px; } .cart i { font-size: 25px; color: white; } .cart:before { content: attr(data-totalitems); font-size: 12px; font-weight: 600; p.........完整代码请登录后点击上方下载按钮下载查看
网友评论0