这几天的工作总结:

1、ios下input会有圆角的问题.

-webkit-appearance:none;

2、阻止冒泡:

event.cancelbubble=true;

event.stopProgration();

3、阻止默认事件:

例如 input type=“submit” 提交时,不符合条件的数据不提交,只有符合条件的数据提交。 如果不符合 弹出提示+阻止默认事件,符合上传。

event.preventdefault();

return false;

4、require.js

index。html

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
        <title>参与记录</title>
        <script type="text/javascript" src="js/glo_view.js" ></script>
        <script src="lib/require.js" data-main="js/main.js"></script>
    </head>
    <body>
        <div id="container"></div>
    </body>
</html>

main。js

require.config({
    
    paths:{
        underscore:'../lib/underscore',
        jquery:'jquery-3.1.0.min',
        backbone:'../lib/backbone',
        text:'../lib/text',
        swiper:'swiper-3.3.1.min',
    }
});
require(['backbone','../js/router'],function(){
    Backbone.history.start();
})

router。js

define(['backbone','jquery'],function(Backbone,$){
    var Router=Backbone.Router.extend({
        
        routes:{
            '':'home',
            },
    });

    home:function(){
      require(['model/render.js'],function(render){
      render.home();
      })
    },

var router=new Router();
    
    return router;
})        

render.js

define(['text!../../view/zhucesuccess.html'],
function(zccghtml){
    function jifenduihuan(){
        $('#container').html(jfdhhtml);
        Glo_tools.toback('.topleft');
        Glo_tools.jifenduihuan();
        Glo_tools.topZero();
    };
    return{
        canyujilu:canyujilu
               } 
})    

功能组件js

define([], function() {

    function input(){
        $('.input-text').bind({
            focus: function() {
                if(this.value == this.defaultValue) {
                    this.value = "";
                    $(this).css('color','#3c3b3b');
                }
            },
            blur: function() {
                if(this.value == "") {
                    this.value = this.defaultValue;
                    $(this).css('color','#b3b3b3');
                    if($(this).val()=='起始时间'||$(this).val()=='截止时间'){
                        $(this).css('color','#3c3b3b');
                    }
                }
            }
        });
    }

    return {
        input: input,

    }

})

或者

define(['jquery'],function($){
    function Glo_tools(){
    
    };
    Glo_tools.prototype={
    topZero:function(){
        $(window).scrollTop(0+'px');
    },
    };
    var dbTools=new Glo_tools();
    return dbTools;
})    

 

posted @ 2016-11-11 13:21  盖大楼  阅读(354)  评论(0编辑  收藏  举报