Explorar o código

user-defined.js

一款之定义函数
WXT往昔 %!s(int64=2) %!d(string=hai) anos
pai
achega
80705c4ed3
Modificáronse 1 ficheiros con 56 adicións e 0 borrados
  1. 56 0
      user-defined.js

+ 56 - 0
user-defined.js

@@ -0,0 +1,56 @@
+数据提交 = function(name = '地址',json = '数据',result = '回调') {
+    $.post('http://localhost:13131/'+name,json,function(data){
+        result(data);
+    })
+}
+
+文字渐显_循环 = function (table = '标签',value = '内容',time = '时间') {
+    let i = 0;
+    setInterval(function () {
+        if (i === value.length){
+         $(table).empty();
+         i=0;
+        }
+        $(table).append(value[i]);
+        i++;
+    },time);
+}
+
+文字渐显_单次 = function (table = '标签',value = '内容',time = '时间') {
+    let i = 0;
+    let j = setInterval(function () {
+        if (i === value.length){
+            clearInterval(j);
+        }
+        $(table).append(value[i]);
+        i++;
+    },time);
+}
+
+滑动显示 = function (table1 = '标签一',time = '时间') {
+    $(table1).css({
+        overflow:'hidden',
+        cursor:'pointer',
+    }).find('div').css({
+        width:$(table1).width(),
+        height:$(table1).height(),
+        background:'rgba(44,62,80,.4)',
+        marginTop:$(table1).height()-$(table1).find('span').height(),
+        cursor:'pointer',
+    }).find('*').css({
+        width:$(table1).width(),
+        color:'#FFF',
+        margin:'5px',
+        textAlign:'left',
+    });
+    $(table1).hover(function(){
+        $(this).find('div').animate({
+            marginTop:'0px',
+        },time)
+    },function(){
+        $(this).find('div').animate({
+            marginTop:$(this).height()-$(this).find('span').height(),
+        },time);
+    });
+}
+