defined.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. 数据提交 = function(name = '地址',json = '数据',result = '回调') {
  2. $.post('http://localhost:13131/'+name,json,function(data){
  3. result(data);
  4. })
  5. }
  6. 文字渐显_循环 = function (table = '标签',value = '内容',time = '时间') {
  7. let i = 0;
  8. setInterval(function () {
  9. if (i === value.length){
  10. $(table).empty();
  11. i=0;
  12. }
  13. $(table).append(value[i]);
  14. i++;
  15. },time);
  16. }
  17. 文字渐显_单次 = function (table = '标签',value = '内容',time = '时间') {
  18. let i = 0;
  19. let j = setInterval(function () {
  20. if (i === value.length){
  21. clearInterval(j);
  22. }
  23. $(table).append(value[i]);
  24. i++;
  25. },time);
  26. }
  27. 滑动显示 = function (table1 = '标签一',time = '时间') {
  28. $(table1).css({
  29. overflow:'hidden',
  30. cursor:'pointer',
  31. }).find('div').css({
  32. width:$(table1).width(),
  33. height:$(table1).height(),
  34. background:'rgba(44,62,80,.4)',
  35. marginTop:$(table1).height()-$(table1).find('span').height(),
  36. cursor:'pointer',
  37. }).find('*').css({
  38. width:$(table1).width(),
  39. color:'#FFF',
  40. margin:'5px',
  41. textAlign:'left',
  42. });
  43. $(table1).hover(function(){
  44. $(this).find('div').animate({
  45. marginTop:'0px',
  46. },time)
  47. },function(){
  48. $(this).find('div').animate({
  49. marginTop:$(this).height()-$(this).find('span').height(),
  50. },time);
  51. });
  52. }
  53. alert_s = function(value = '类容'){
  54. $('body').append(`
  55. <div id="alert" style="background:transparent;
  56. left:0px;
  57. right:0px;
  58. top:0px;
  59. bottom:0px;
  60. margin:auto;
  61. text-align: center;
  62. position:fixed;
  63. z-index:999999;">
  64. <div style="text-align: center;position:absolute;
  65. left:0px;right:0px;top:0px;bottom:0px;margin:auto;
  66. width:150px;height:35px;border-radius:5px;background: rgba(0,0,0,0.3)">
  67. <span style="height:35px;line-height:35px;color: #ffffff;font-size: 13px">${value}</span>
  68. </div>
  69. </div>`);
  70. setTimeout(function () {
  71. $('#alert').remove();
  72. },500)
  73. }