bank_card.js 1.34 KB
/**
 * Created by moli on 15/9/14.
 */

define(function(require, exports, module) {
    var $ = require("jquery"),
        Alert = require("Alert");
    require("swipe");
    require("popup");

    $(function(){
        var methods = {
            thisView : null,
            hideDel : function(e){
                if(e){methods.thisView = $(e)};
                methods.thisView.find(".bank-view").animate({"left":"-52px"},400);
                methods.thisView.find(".del").animate({"right":"0px"},400);
            },
            showDel : function(e){
                if(e){methods.thisView = $(e)};
                methods.thisView.find(".bank-view").animate({"left":"0px"},400);
                methods.thisView.find(".del").animate({"right":"-75px"},400);
            }
        };
        $(".cell").swipe({
            swipe:function(event, direction, distance, duration, fingerCount) {
                if(direction == "left"){
                    methods.hideDel(this);
                }else if(direction == "right"){
                    methods.showDel(this);
                }
            }
        });

        $("#closeDelBank").bind("click", function(){
            methods.thisView.remove();
            Alert.show('删除成功');
        });
        $("#cancelDelBank").bind("click", function(){
            methods.showDel();
        });
    });
});