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