zoukankan      html  css  js  c++  java
  • 2016年gift上线相关知识点记录

    1、图片初始化加载

    2、如何判断横屏

     function horAver() {
            if (window.orientation == 90 || window.orientation == -90) {
                alert("建议竖起手机玩游戏:-D");
            }
        }
        window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", horAver, false);
    

    3、pageShow的使用

    var count=0;
      window.addEventListener('pageshow', function(event) {
        count++;
        if(count>1)
        {
          alert(11111);
        }
      });
    

    4、动画避免使用setInterval,改为css3,间隔时间可从keyframes中改变

    @-webkit-keyframes wobble {
    70% { -webkit-transform: translateY(0%); }
    75% { -webkit-transform: translateY(-5%) rotate(-5deg); }
    80% { -webkit-transform: translateY(4%) rotate(3deg); }
    85% { -webkit-transform: translateY(-3%) rotate(-3deg); }
    90% { -webkit-transform: translateY(2%) rotate(2deg); }
    95% { -webkit-transform: translateY(-1%) rotate(-1deg); }
    100% { -webkit-transform: translateY(0%); }
    }
    

    5、修改地址、通过地址传递参数,获取参数

    function getQuery(key){
       var arr = window.location.search.split('&')
       for (var i = 0; i < arr.length; i++) {  
            var ar = arr[i].split("=");  
            if (ar[0] == key) {  
                return arr[1];  
            }  
        }   
         return "";  
    }   
     
    

    6、提交表单过程添加loading图片

    <form action="#" method="" name="form1" class="f_form" onsubmit="return isForm(this)">
                    <input type="text" placeholder="姓名" name="name">
                    <input type="text" placeholder="电话" name="tel">
                    <input type="hidden" name="platform" value=“">
                    <input type="button" value="提 交" id="j_formsubmit" class="btn">
    </form>
    
    $('#j_formsubmit').on('click',function(event){
            if(isForm(document.form1))
            {
                document.form1.submit();
                $('.loading_gif').html('<img src="http://n.sinaimg.cn/mobileh5/dc9d8119/20160107/loading.gif" />');
            }
        })
     
    
     function isForm() {
      var oForm = $('.f_form')[0];
      if (!oForm.children[0].value) {
        alert('请输入姓名');
        return false;
      } else if (!/^0?1[3|4|5|7|8][0-9]d{8}$/.test(oForm.children[1].value)) {
        alert('请输入正确手机号')
        return false;
      } else {
      return true;
      }
    }
    

      

     

  • 相关阅读:
    linux查看存储盘
    aix中hd5对应什么设备?
    (转)Python 操作 Windows 粘贴板
    eclipse非主窗口的停靠(正常), 恢复, 最小化, 最大化的切换
    (转)HTML5 本地数据库(SQLite) 示例
    [译] 如何像 Python 高手一样编程?
    scrapy递归下载网站
    eclipse快捷键以及使用技巧大全
    python任意编码转utf8或者unicode
    apache快速配置简易网站
  • 原文地址:https://www.cnblogs.com/a67cm/p/5125339.html
Copyright © 2011-2022 走看看