fun.js 494 B

12345678910
  1. window.fun = function fun(e){ setTimeout(() => {
  2. e = e || {}; var $img = $('<div class="joy"></div>')
  3. .css({position: 'fixed', width: 100,
  4. top: (e.y || e.clientY || (Math.random() * $(window).height()))-50,
  5. left: (e.x || e.clientX || e.pageX || (Math.random() * $(window).width()))-50,
  6. transform: 'rotate('+(Math.random() * 360)+'deg)'
  7. }).appendTo('body');
  8. setTimeout(() => { $img.remove() },800);
  9. },10)};
  10. $(document).on('keyup', fun).on('touchstart', fun).on('mousedown', fun);