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

 找回密码
 立即注册
查看: 7133|回复: 3

【Article】ArticleView版块设计示范脚本

[复制链接]
发表于 2014-7-28 17:08:12 | 显示全部楼层 |阅读模式
列出常见的多款方案CSS代码,直接复制相应的方案,对width,height等稍作修改即可使用,弘帝建站系统助您快速建站。

方案一:文章缩略列表 保持图片长宽比,并且保证图片水平垂直居中,通过IE/Chrome验证
#ArticleView ul{ margin:0px; padding:0px; height:auto; list-style-type:none; display:block;}
#ArticleView ul li{ float:left; display:block; width:179px; height:170px; margin:2px; overflow:hidden; border:1px solid #efefef;}
#ArticleView ul li .thumbs{ width:179px; height:148px; display:table-cell; text-align:center; vertical-align:middle; *position:relative; *vertical-align:baseline;}
#ArticleView ul li .thumbs .middle{ *position:absolute; *top:50%; *left:50%;}
#ArticleView ul li .thumbs a{ display:inline-block; border:1px solid #dfdfdf; *float:left; *display:block; *line-height:1em; *position:relative; *top:-50%; *left:-50%;}
#ArticleView ul li .thumbs a:hover{ border:1px solid #888888;}
#ArticleView ul li .thumbs img{ border:0px; max-width:177px; max-height:148px;}
#ArticleView ul li .atext{ border:0; display:block;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; clear:both;}

方案一简化(案例:模板hl)
#ArticleView ul{ margin:0px; padding:0px; height:auto; list-style-type:none; display:block;}
#ArticleView ul li{ float:left; display:block; width:179px; height:170px; margin:8px; overflow:hidden; border:1px solid #efefef; padding:10px;}
#ArticleView ul li .thumbs{ width:179px; height:148px; display:table-cell; text-align:center; vertical-align:middle;}
#ArticleView ul li:hover{ border:1px solid #ddd; background:#eee;}
#ArticleView ul li .thumbs img{ border:0px; max-width:177px; max-height:148px;}
#ArticleView ul li .atext{ border:0; display:block;white-space:nowrap; text-align:center; overflow:hidden; text-overflow:ellipsis; clear:both;}

方案二:文章缩略列表 保持图片固定长宽
#ArticleView ul{ margin:0px; padding:0px; height:auto; list-style-type:none; display:block;}
#ArticleView ul li{ float:left; display:block; width:179px; height:170px; margin:2px; overflow:hidden; border:1px solid #efefef;}
#ArticleView ul li .thumbs{ width:179px; height:148px;}
#ArticleView ul li .thumbs a{ display:inline-block; border:1px solid #dfdfdf; }
#ArticleView ul li .thumbs a:hover{ border:1px solid #888888;}
#ArticleView ul li .thumbs img{ border:0px; width:177px; height:148px;}
#ArticleView ul li .atext{ border:0; display:block;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; clear:both;}

方案三:文章图片外框白色,列表HOVER时橙色
#ArticleView ul li{ float:left; display:block; width:168px; height:168px; margin:0 6px; text-align:center; margin-top:10px;}
#ArticleView img{ width:160px; height:130px; border:4px solid #fff;}
#ArticleView ul li:hover img{ border:0; border-bottom:4px solid #fff;}
#ArticleView ul li:hover{ border:4px solid #f80; width:160px; height:160px;}
(模板:hb  案例:gxhbfs)

更多风格方案,敬请期待。如果方案在不同浏览器效果不同,未达到您的效果,请在下方留言,我们将努力完善。
回复

使用道具 举报

 楼主| 发表于 2018-4-24 06:15:25 | 显示全部楼层

flex优化后完美自适应效果

在bootstrap设计方案中(后台整站布局管理-->高级-->前端框架),xs设备显示2行,lg显示3行,否则显示4行。
客户案例.jpg
<div class="case">$func_article(navi=Navigator,para=Case,len=12,title=10)$</div>
CSS:
#ArticleView ul,#ProductView ul{ display: flex; width: 100%; flex-direction: row; flex-wrap: wrap; justify-content:space-between;}
#ArticleView ul li,#ProductView ul li{ float: left; width:24%; max-height:300px; margin-bottom:1em;}
#ArticleView ul li .thumbs,#ProductView ul li .thumbs{ display: block; width: 100%; height:calc(100% - 2em);}
#ArticleView ul li .thumbs a,#ProductView ul li .thumbs a{ display: flex; width: 100%; height: 100%; align-items: center; justify-content: center;}
#ArticleView ul li img,#ProductView ul li img{ padding: 0.25rem; background-color: #fff; border: 1px solid #dee2e6; border-radius: 0.25rem; max-width: 100%; max-height:100%;}
#ArticleView ul li a,#ProductView ul li a{ display: block; line-height: 2em; text-align: center;}
@media (max-width: 992px) {
    #ArticleView ul li,#ProductView ul li{ width: 33%;}
}
@media (max-width: 768px)  {
    #ArticleView ul li,#ProductView ul li{ width: 48%;}
}
@media (max-width: 576px)  {
    #ArticleView ul li,#ProductView ul li { width:50%;}
}
回复 支持 反对

使用道具 举报

 楼主| 发表于 2022-7-7 21:32:18 | 显示全部楼层

220706成功能案例

220706.jpg
HTML:
<div class="case py-5">
    <div class="container text-center img-zoom">
        $func_article(navi=nav,para=case,rows=5,title=11)$
    </div>
</div>
CSS:
.case {
    #ArticleView {

        ul {
            padding-left: 15px;

            li {
                padding-left: 0;

                &:first-child {
                    flex-basis: 100% !important;

                    .title {
                        display: block !important;
                        width: 100%;
                        position: absolute;
                        bottom: 0;
                        left: 0;
                        z-index: 10;
                        background-color: rgba(white, .4);
                    }
                }

                .title {
                    display: none !important;
                }

                &:hover {
                    .title {
                        display: block !important;
                        width: 100%;
                        position: absolute;
                        bottom: 0;
                        left: 0;
                        z-index: 10;
                        background-color: rgba(white, .4);
                    }
                }
            }
        }
    }
}


@include media-breakpoint-up(md) {
    .case {
        #ArticleView {
            margin-top: 2rem;
            position: relative;

            ul {
                padding-left: 50%;

                li {
                    flex-basis: 50% !important;

                    &:first-child {
                        position: absolute;
                        width: calc(50% - 30px);
                        height: calc(100% - 10px);
                        left: 0;
                        top: 0;
                        z-index: 10;
                        padding-bottom: 0;
                        padding-right: 0;
                        margin-right: 15px;

                        .thumbs {
                            height: 100%;

                            img {
                                min-height: 100%;
                            }
                        }
                    }
                }
            }
        }
    }
}

回复 支持 反对

使用道具 举报

 楼主| 发表于 2025-5-27 15:34:47 | 显示全部楼层
DEMO:osbbek

微信图片_20250527113239.jpg
HTML:
<div class="industry py-5">
    <div class="container-xxl">
        $func_article(navi=nav,title=11,memo=1,more=11,para=industry,divi=none,rows=5,show=title|memo|more|content)$
    </div>
</div>


CSS:
.industry {
    border-bottom: 1px solid $gray-300;

    .Margin {
        overflow: hidden;
    }

    .More {
        display: flex;
        flex: 1;
        justify-content: center;
        margin-bottom: 2rem;

        a {
            border: 1px solid $fst;
            color: $fst;
            padding: 10px 20px;
            border-radius: 20px;

            &:hover {
                background-color: $fst;
                color: white;
            }
        }
    }

    .container-xxl {
        .Content {
            // 容器样式(完整参数)
            position: relative;
            height: 30vh;
            min-height: 300px;
            width: 100%;
            // perspective: 1800px;
            // overflow: visible;
            // background: linear-gradient(to bottom, #f8f9fa 0%, #e9ecef 100%);

            // 内边距容器(完整保留原有class)
            .Margin {
                height: 100%;
                width: 100%;
                padding: 20px 0;
                box-sizing: border-box;

                // 文章视图容器(完整保留原有id)
                #ArticleView {
                    height: calc(100% - 40px);
                    width: 100%;
                    position: relative;
                    overflow: visible;

                    // 列表样式(完整参数)
                    ul {
                        list-style: none;
                        padding: 0;
                        margin: 0;
                        height: 100%;
                        width: 100%;
                        position: relative;

                        // 列表项完整样式
                        li {
                            position: absolute;
                            top: 50%;
                            left: 50%;
                            width: 100%;
                            // height: 720px;
                            transform-style: preserve-3d;
                            transition: all 1.2s cubic-bezier(0.22, 0.61, 0.36, 1);
                            transform: translate(-50%, -50%);
                            will-change: transform;
                            backface-visibility: hidden;

                            // 图片容器完整样式
                            .gutters {
                                position: relative;
                                height: 100%;
                                width: 100%;
                                box-sizing: border-box;

                                // 图片完整样式
                                .thumbs {
                                    height: 100%;

                                    a {
                                        display: block;
                                        height: 100%;
                                        width: 100%;
                                        overflow: hidden;
                                        border-radius: 8px;

                                        img {
                                            width: 100%;
                                            height: 100%;
                                            object-fit: contain;
                                            object-position: center center;
                                            transition: transform 0.3s ease;
                                        }
                                    }
                                }

                                // 标题完整样式
                                .title {
                                    display: none;
                                    position: absolute;
                                    bottom: 25px;
                                    left: 50%;
                                    transform: translateX(-50%);
                                    font-weight: 500;
                                    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
                                    white-space: nowrap;
                                    max-width: 90%;
                                    overflow: hidden;
                                    text-overflow: ellipsis;

                                    a {
                                        color: white;
                                        font-size: 16px;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}


JS:
document.addEventListener('DOMContentLoaded', () => {
    // 获取所有轮播项
    const items = document.querySelectorAll('.industry #ArticleView li');

    // 三维位置参数配置(完整参数说明)
    const positions = [{ // 左侧后方
            // x: -320,    // 水平偏移(像素)
            x: -480, // 水平偏移(像素)
            z: -600, // 景深位移(像素)
            scale: 0.4, // 缩放比例
            rotateY: 15, // Y轴旋转(度)
            opacity: 0.8
        },
        { // 左侧中层
            // x: -160,
            x: -240,
            z: -300,
            scale: 0.7,
            rotateY: 8,
            opacity: 0.9
        },
        { // 中心前景
            x: 0,
            z: 0,
            scale: 1,
            rotateY: 0,
            opacity: 1
        },
        { // 右侧中层
            x: 160,
            x: 240,
            z: -300,
            scale: 0.7,
            rotateY: -8,
            opacity: 0.9
        },
        { // 右侧后方
            x: 320,
            x: 480,
            z: -600,
            scale: 0.4,
            rotateY: -15,
            opacity: 0.8
        }
    ];

    // 动态布局函数(完整逻辑)
    function updateLayout() {
        const container = document.querySelector('.industry .Content');
        container.style.height = container.offsetWidth * 3 / 5 + "px";
        const containerWidth = container.offsetWidth;
        const containerHeight = container.offsetHeight;

        // console.log(containerWidth+"-"+containerHeight);

        items.forEach((item, index) => {
            const posIndex = (index + currentIndex) % 5;
            const pos = positions[posIndex];
            const imgContainer = item.querySelector('.gutters');

            // 精确计算尺寸
            // const baseSize = Math.min(containerWidth * 0.28, 480);
            const baseSize = Math.min(containerWidth * 0.8, containerWidth);
            item.style.width = `${baseSize}px`;
            item.style.height = `${baseSize * 1.5}px`;

            // 三维变换
            item.style.transform = `
                translate(
                    calc(-50% + ${(pos.x / 1280) * containerWidth}px),
                    -50%
                )
                translateZ(${pos.z}px)
                scale(${pos.scale})
                rotateY(${pos.rotateY}deg)
            `;

            // 视觉效果控制
            item.style.zIndex = 5 - Math.abs(posIndex - 2);
            item.style.opacity = pos.opacity;
            imgContainer.style.transform = `scale(${1 + (1 - pos.scale)/2})`;
        });
    }

    // 窗口自适应处理(完整事件监听)
    let resizeTimer;
    window.addEventListener('resize', () => {
        clearTimeout(resizeTimer);
        resizeTimer = setTimeout(() => {
            updateLayout();
        }, 250);
    });

    // 自动轮播控制(完整定时器逻辑)
    let currentIndex = 0;
    const animationInterval = setInterval(() => {
        currentIndex = (currentIndex + 1) % 5;
        updateLayout();
    }, 4000);

    // 初始化执行
    updateLayout();
});


回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-6-17 03:31 , Processed in 0.063714 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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