user-defined.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. }