lisaShare

点击数值 +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();
	});
});

分类:

技术点:

相关文章:

  • 2021-11-17
  • 2021-11-27
  • 2021-12-25
  • 2021-12-25
  • 2021-12-25
  • 2021-12-30
  • 2021-07-21
  • 2021-10-16
猜你喜欢
  • 2021-12-25
  • 2021-12-25
  • 2021-08-02
  • 2021-12-25
  • 2021-08-13
  • 2021-12-25
  • 2021-11-11
相关资源
相似解决方案