js+css 动效+1的效果


点击数值 +1 的动效

vue

data:{
    timer: null,plus:''// 次数
}
method:{
    animate(plus) {
          var _this = this;
          clearInterval(_this.timer);
          _this.timer = setInterval(function () {
               plus--;
               if (plus <= 0) {
                    clearInterval(_this.timer)
               }
               var $i = $("<i>+1</i>");
                $('.popularity-values').append($i);
                $i.animate({
                    "top": '-1.1rem',
                    "right": '-0.9rem',
                    // "top": '-55px',
                    // "right": '-45px',
                    "opacity": 0.1,
                    "fontSize": '0.46rem'
                }, 1800, function () {
                   $i.remove();
               });
           }, 800)
       }
}
jQ 点击 +1 动效
jQuery(document).ready(function ($) {
    $("html,body").click(function (e) {
        // var n = Math.round(Math.random() * 100);
	var n = 1;
	var $i = $("<b/>").text("+" + n);
	var x = e.pageX,
	    y = e.pageY;
	$i.css({
		"z-index": 99999,
		  "top": y - 20,
		  "left": x,
		  "position": "absolute",
		   "color": "#E94F06"
	});
	$("body").append($i);
		$i.animate({
		     "top": y - 180,
		     "opacity": 0
		}, 1500, function () {
		 $i.remove();
	  });
	  e.stopPropagation();
	});
});


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM