xadmin 小组件默认折叠

  • 修改xadmin/static/xadmin/js/xadmin.plugin.portal.js文件
jQuery(function () {
    //添加下面两句
    $("div.panel.panel-default.widget.html .panel-heading .icon.chevron").toggleClass("fa fa-chevron-up").toggleClass("fa fa-chevron-down");
    $("div.panel.panel-default.widget.html .panel-body").toggle('fast');

    $(".column").sortable({
        connectWith: ".column",
        handle: '.panel-heading',
        forcePlaceholderSize: true,
        cursor: "move",
        cancel: ".unsort, .tab-content",
        stop: function (event, ui) {
            var pos = [];
            $('.column').each(function () {
                var col = [];
                $(this).find('.panel').each(function () {
                    col.push($(this).attr('id'));
                });
                pos.push(col.join(','));
            });
            var pos_val = pos.join('|');
            var key = $('#_portal_key').val();
            $.save_user_settings(key, pos_val, function () {
                //alert('success');
            });
        }
    });

    $(".panel-heading .icon.chevron").click(function () {
        $(this).toggleClass("fa fa-chevron-up").toggleClass("fa fa-chevron-down");
        $(this).parents(".panel:first").find(".panel-body").toggle('fast');
    });


});
posted @ 2019-07-30 17:08  twfb  阅读(555)  评论(0编辑  收藏  举报