[jQuery]项目初始化

//Main Function
var Main = function() {
    //function to activate
    var fuc1 = function(){
        console.log("This is 1");
    }
    var fuc2 = function(){
        console.log("This is 2");
    }
    var fuc3 = function(){
        console.log("This is 3");
    }
    var fuc4 = function(){
        console.log("This is 4");
    }
    //function to activate the Go-Top button
    var runGoTop = function() {
        $('.go-top').on('click', function(e) {
            e.preventDefault();
            $("html, body").animate({
                scrollTop: 0
            }, "slow");
            return false;
        });
    };

    return {
        //main function to initiate template pages
        init: function() {
            fuc1();
            fuc2();
            fuc3();
            fuc4();
            runGoTop();
        }
    };
}();


jQuery(document).ready(function() {
    Main.init();
});
原文地址:https://www.cnblogs.com/SoYang/p/14811242.html