feat(prosperous): 添加富强民主上升文字鼠标点击特效,#71

This commit is contained in:
nineya 2023-12-04 11:46:34 +08:00
parent 74c40244a3
commit 649400ba17
3 changed files with 26 additions and 0 deletions

View File

@ -977,6 +977,8 @@ spec:
label: 烟花特效
- value: granule
label: 粒子爆炸
- value: prosperous
label: 富强民主
- $formkit: radio
name: enable_sw
label: "启用 Service Worker 优化"

View File

@ -0,0 +1,23 @@
var a_idx = 0
jQuery(document).ready(function ($) {
$('body').click(function (e) {
var a = ['富强', '民主', '文明', '和谐', '自由', '平等', '公正', '法治', '爱国', '敬业', '诚信', '友善']
var $i = $('<span/>').text(a[a_idx])
a_idx = (a_idx + 1) % a.length
var x = e.pageX, y = e.pageY
let scrolly = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop
y = y - scrolly
$i.css({
'z-index': 999,
'top': y - 20,
'left': x,
'position': 'fixed',
'font-weight': 'bold',
'color': /*"#ff6651" 随机颜色写法:*/ 'rgb(' + ~~(255 * Math.random()) + ',' + ~~(255 * Math.random()) + ',' + ~~(255 * Math.random()) + ')'
})
$('body').append($i)
$i.animate({'top': y - 180, 'opacity': 0}, 1500, function () {
$i.remove()
})
})
})

View File

@ -0,0 +1 @@
(()=>{var a=0;jQuery(document).ready(function(n){n("body").click(function(o){var t=["富强","民主","文明","和谐","自由","平等","公正","法治","爱国","敬业","诚信","友善"],e=n("<span/>").text(t[a]),t=(a=(a+1)%t.length,o.pageX),o=o.pageY;o-=window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop,e.css({"z-index":999,top:o-20,left:t,position:"fixed","font-weight":"bold",color:"rgb("+~~(255*Math.random())+","+~~(255*Math.random())+","+~~(255*Math.random())+")"}),n("body").append(e),e.animate({top:o-180,opacity:0},1500,function(){e.remove()})})})})();