弘帝企业智能建站系统交流平台

 找回密码
 立即注册
查看: 40|回复: 0

弘帝JS框架中carousel更新日志

[复制链接]
发表于 2025-6-3 16:36:15 | 显示全部楼层 |阅读模式
2025年6月3日更新

修改了函数responsive(o, w) ,参考模板meiyi
function responsive(o, w) {
    var breakpoints = [{
            name: "cols-xxl",
            width: 1400,
            cols: 6
        },
        {
            name: "cols-xl",
            width: 1200,
            cols: 5
        },
        {
            name: "cols-lg",
            width: 992,
            cols: 4
        },
        {
            name: "cols-md",
            width: 768,
            cols: 3
        },
        {
            name: "cols-sm",
            width: 576,
            cols: 2
        },
        {
            name: "cols-xs",
            width: 200,
            cols: 1
        }
    ];

    // 按宽度从大到小排序
    breakpoints.sort((a, b) => b.width - a.width);
   
    var cols = 2; // 默认值

    for (var i = 0; i < breakpoints.length; i++) {
        var breakpoint = breakpoints;
        
        if (w >= breakpoint.width) {
            // 优先使用元素上定义的属性值
            var attrValue = o.attr(breakpoint.name);
            
            if (attrValue !== undefined && attrValue !== "") {
                cols = parseInt(attrValue) || breakpoint.cols;
            } else {
                cols = breakpoint.cols;
            }
            
            // 找到最匹配的断点后立即返回
            return cols;
        }
    }
   
    return cols; // 如果所有断点都不匹配,返回默认值
}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|芜湖万网信息技术服务中心 弘帝企业智能建站系统 ( 皖ICP备07503252号 )

GMT+8, 2025-6-16 19:05 , Processed in 0.072538 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表