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

 找回密码
 立即注册
12
返回列表 发新帖
楼主: admin

SubMenu子菜单导航功能示范脚本

[复制链接]
 楼主| 发表于 2018-4-23 17:43:18 | 显示全部楼层

.nav-thumb-list-circle


<div class="bg-light"><div class="container nav-thumb-list-circle">$func_submenu(navi=Navigator,title=0,para=IPR,rows=5,subimg=1,submemo=1,sub=1,mode=2,divi=none)$</div></div>
CSS
.nav-thumb-list-circle ul{display: flex; flex-direction: row; flex-wrap:nowrap; justify-content: space-between; text-align:center;}
.nav-thumb-list-circle ul li{ float:left; flex: 1; margin:10px;}
.nav-thumb-list-circle ul li .more{ display:none;}
.nav-thumb-list-circle ul li .thumbs{ display:flex; align-items: center; justify-content: center;}
.nav-thumb-list-circle ul li .thumbs img{ width:50%; height:50%; border-radius:50%;}
.nav-thumb-list-circle ul li .title .cn,.nav-thumb-list-circle ul li .title .cn a{ display:block; font-weight:bold; color:#1F5BA3;}
.nav-thumb-list-circle ul li .title .en,.nav-thumb-list-circle ul li .title .en a{ color:#1F5BA3;}
.nav-thumb-list-circle ul li .title a{ display: block; font-weight:bold; font-size: 16px; line-height: 40px;}
回复 支持 反对

使用道具 举报

 楼主| 发表于 2018-5-23 10:49:53 | 显示全部楼层

zyipm.submenu.css

zyipm.jpg
DIV:
<div class="adv wrap">$func_submenu(para=Advantage,title=0,mode=10,rows=3,subtitle=1,subimg=1,submemo=1,divi=none)$</div>
CSS:
.adv .Margin ul{ display: flex; flex-flow: row nowrap; justify-content: space-between; margin-top:30px;}
.adv ul li{ flex: 1; margin: 40px 0; border: 10px solid #46A6EC; background: #46A6EC;}
.adv ul li:nth-child(2) {margin-left: 90px; margin-right:90px;}
.adv .mode{ position: relative;}
.adv .mode h3{padding: 10px 0; text-align: center;}
.adv .mode h4{ position: absolute; border: 12px solid rgb(70, 166, 235,.3); width: 80px; height:80px; left:calc(50% - 45px); top: -45px; border-radius:40px;}
.adv .mode h4 a{ display:block;text-align: center; line-height:55px; width: 100%; height: 100%; font-size: 16px; background: #46A6EC; border-radius: 30px;}
回复 支持 反对

使用道具 举报

 楼主| 发表于 2019-8-23 22:10:44 | 显示全部楼层

随机关键词搜索示范

ggdymy.jpg
设计要点:超过10个关键词随机选择。
DIV:
<div class="keyword">$func_submenu(navi=Nav,para=Search,memo=1)$</div>
CSS:
.keyword .Descript{display:flex; flex-flow:row wrap;justify-content: space-between;padding-top:10px; padding-bottom: 20px;}
.keyword .Descript a{ padding:10px;cursor: pointer;}

JS:
$(function () {
    var kw = $(".keyword").find(".Descript").html();
    var k = kw.split(' ');
    var kws = [];
    var html = "";
    for (var i = 0; i < k.length; i++) {
        if (k != "") {
            kws.push(k);
        }
    }
    var rand = [];
    rand = rnd(0, kws.length, 10);
    for (var i = 0; i < rand.length; i++) {
        html = html + "<a>" + kws[rand] + "</a>"
    }
    $(".keyword").find(".Descript").html(html).find("a").on("click", function () {
        var kw = $(this).html();
        $.send("",{kw:kw,so:1});
    });
})

function rnd(min, max, count) {
    var randoms = [];
    while (true) {
        var isExists = false;
        var random = parseInt(min + (max - min) * (Math.random()))
        for (var i = 0; i < randoms.length; i++) {
            if (random === randoms) {
                isExists = true;
                break;
            }
        }
        if (!isExists)
            randoms.push(random);
        if (randoms.length === count)
            break;
    }
    return randoms;
}



回复 支持 反对

使用道具 举报

 楼主| 发表于 2022-9-3 12:52:37 | 显示全部楼层
模板:220828
DIV:
<div class="container-xxl product justify-content-center ul-col ul-lg-5">
    $func_submenu(para=product,sub=1,divi=none,rows=10,mode=2,bg=1,submemo=1,subimg=1,submore=3)$
</div>

submenu.220828.jpg
CSS:
.product {
    ul {
        li {
            .mode {
                .thumbs {
                    align-items: center;
                    background: url(../img/bg.png) $fst;
                    border-radius: 1rem;
                    height: 150px;
                    margin-bottom: -2rem;

                    img {
                        max-height: 68px;
                    }
                }

                .title {
                    margin-left: 1rem;
                    margin-right: 1rem;
                    background-color: $gray-200;
                    border-top-left-radius: 1rem;
                    border-top-right-radius: 1rem;
                    padding-top: 2rem;

                    a {
                        font-size: 24px !important;
                        font-weight: 700;
                    }
                }

                .memo {
                    margin-left: 1rem;
                    margin-right: 1rem;
                    color: $gray-600;
                    padding: 1rem;
                    background-color: $gray-200;
                }

                .more {
                    margin-left: 1rem;
                    margin-right: 1rem;
                    background-color: $gray-200;
                    border-bottom-left-radius: 1rem;
                    border-bottom-right-radius: 1rem;
                    padding-bottom: 2rem;

                    a {
                        padding:8px 25px;
                        color: $sec;
                        font-size: 16px;

                        &:hover{
                            border-radius: .5rem;
                            background:$sec;
                            color:white;
                            transition: all 1s ease-in;
                        }
                    }
                }
            }
        }
    }
}

回复 支持 反对

使用道具 举报

 楼主| 发表于 2022-9-5 00:30:33 | 显示全部楼层

模板:SubMenu.220901

submenu.220901.jpg
DIV:
<div class="product justify-content-center ul-col ratio-thumbs" ratio="4:3">
    $func_submenu(para=product,sub=1,divi=none,rows=10,bg=1,mode=3,submemo=1,subimg=3,submore=3)$
</div>
这儿显示图片的比率为4:3,由.ratio-thumbs来确定是对thumbs进行ratio=4:3控制。

CSS:
.product {
    ul {
        li {
            background-color: $gray-300;
            background-clip: content-box;
            flex-flow: row nowrap;
            flex-basis: 100%;
            padding-bottom: 0;

            .thumbs {
                display: flex;
                flex: 1 0 150px;
                padding: 0;
                margin: 0 15px 0 0;
                overflow: hidden;

                img {
                    width: 100%;
                    height: 100%;
                    object-fit: cover;
                }
            }

            .mode {
                text-align: left;
                padding: 1rem;

                .title {
                    a {
                        padding: 0 !important;
                        margin: 0;
                        line-height: 2.2em;
                        font-weight: 800;
                        font-size: 1.8rem !important;
                    }
                }

                .more {
                    margin-top: 1rem;

                    a {
                        line-height: 3em;
                    }
                }
            }

        }
    }
}
@include media-breakpoint-up(sm) {
    .product {
        ul li {
            display: flex;
            flex-flow: column wrap;
            flex-basis: 50%;
            padding: 1.5rem;

            .thumbs {
                flex-basis: auto;
                margin-right: 0;
            }

            &:first-child {
                flex-basis: 100%;
            }

            .mode {
                padding:2rem;
            }
        }
    }
}

@include media-breakpoint-up(lg) {
    .product {
        ul {
            li {
                flex-basis: 33.33%;

                .mode {
                    padding: 2rem;
                }

                &:first-child {
                    flex-basis: 66.66%;
                }

                &:nth-child(-n+2) {
                    .thumbs {
                        max-height: 468px;
                    }

                    .mode {
                        position: absolute;
                        width: calc(100% - 3rem);
                        bottom: 1.5rem;
                        background-color: rgba($white, .8);
                    }
                }
            }
        }
    }
}


回复 支持 反对

使用道具 举报

 楼主| 发表于 2026-7-5 18:09:31 | 显示全部楼层

静态展示可左右移动菜单视图列表超过部分隐藏,支持手机触摸左右滚动

模板:wqych-move
PC:
微信图片_2026-07-05_180616_715.png
MOBILE:
微信图片_2026-07-05_180717_061.png
DIV:
<div class="product py-5">
    <div class="container-flush py-5 nav move_x">
        $func_submenu(para=Product,title=10,rows=6,more=2,border=1,divi=none,mode=2,subimg=1,submemo=1)$
    </div>
</div>
CSS:
.product {

    .Content {
        display: flex;
        flex: 1;
        justify-content: center;
        align-items: center;
        flex-flow: row nowrap;

        #NavLeft,
        #NavRight {
            display: none;

            @include media-breakpoint-up(xl) {
                display: flex;
                flex: 0 0 20px;
                height: 100%;
                justify-content: center;
                align-items: center;
                background-color: $gray-100;

                &::before {
                    display: inline-flex;
                    flex: 1;
                    justify-content: center;
                    align-items: center;
                    height: 50px;
                    font-weight: 900;
                    transform: scaleY(3);
                    transform-origin: center;
                    content: "<";
                }
            }
        }

        #NavRight {
            order: 1;

            &::before {
                content: ">";
            }
        }

        .Margin {
            display: flex;
            flex: 0 0 100%;
            overflow: hidden;
            position: relative;

            @include media-breakpoint-up(xl) {
                flex-basis: calc(100% - 40px);
            }

            ul {
                display: flex;
                flex: 1;
                flex-direction: row;
                margin-left: -15px;
                margin-right: -15px;

                li {
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    flex: 0 0 50% !important;

                    @include media-breakpoint-up(lg) {
                        flex-basis: 33.333% !important;
                    }

                    box {
                        display: flex;
                        flex: 1;
                        width: 100%;
                        height: 100%;
                        padding: 15px;

                        .mode {
                            display: flex;
                            flex-direction: column;
                            justify-content: center;
                            align-items: center;
                            flex: 1;
                            height: 100%;
                            padding: 15px;

                            .thumbs {
                                width: 100%;
                                height: 100%;
                                opacity: 1;
                                transition: opacity 0.6s ease;
                                pointer-events: none;

                                @include media-breakpoint-up(sm) {
                                    z-index: inherit;
                                }

                                img {
                                    width: 100%;
                                    aspect-ratio: 3 / 2;
                                    object-fit: cover;
                                    mask-image: radial-gradient(circle at center,
                                            rgba(0, 0, 0, 0.1) 10%,
                                            rgba(0, 0, 0, 0.1) 30%,
                                            black 70%);
                                    -webkit-mask-image: radial-gradient(circle at center,
                                            rgba(0, 0, 0, 0.1) 10%,
                                            rgba(0, 0, 0, 0.1) 30%,
                                            black 70%);

                                    @include media-breakpoint-up(sm) {
                                        mask-image: inherit;
                                        -webkit-mask-image: inherit;
                                    }
                                }

                            }

                            .title {
                                a {
                                    font-size: 2rem;
                                    font-weight: 600;
                                    justify-content: center;
                                    color: $gray-900;
                                    padding-left: 0;
                                    padding-right: 0;

                                    &:hover {
                                        color: $fst;
                                    }
                                }
                            }

                            .memo {
                                display: none;

                                @include media-breakpoint-up(sm) {
                                    display: flex;
                                }
                            }

                        }

                    }

                    &:hover {
                        box .mode .thumbs {
                            opacity: .1;
                        }
                    }
                }

            }
        }
    }
}


JS:
let $product = $('.product');
let $content = $product.find('.Content');
let $scrollWrap = $content.find('.Margin'); // 真正滚动容器
let $ul = $scrollWrap.find('ul.cn');

// 统一滚动函数
function scrollHandle(type) {
    // 获取单个li完整宽度(包含margin padding border)
    let liWidth = $ul.find('li').outerWidth(true);
    let currentScroll = $scrollWrap.scrollLeft();
    let targetScroll;

    if (type === 'left') {
        // 向左滚动
        targetScroll = currentScroll - liWidth;
        targetScroll = Math.max(targetScroll, 0);
    } else {
        // 向右滚动,计算最大可滚动距离
        let maxScroll = $scrollWrap[0].scrollWidth - $scrollWrap[0].clientWidth;
        targetScroll = currentScroll + liWidth;
        targetScroll = Math.min(targetScroll, maxScroll);
    }

    // 执行平滑滚动动画
    $scrollWrap.stop().animate({ scrollLeft: targetScroll }, 300);
}

// 事件委托父级改为 .Content,匹配按钮父容器
$content.on('click touchstart', '#NavLeft, #NavRight', function (e) {
    // 解决移动端touch+click两次触发
    if (e.type === 'touchstart') {
        e.stopPropagation();
        return false;
    }
    // 判断左右按钮
    let scrollType = $(this).attr('id') === 'NavLeft' ? 'left' : 'right';
    scrollHandle(scrollType);
});

回复 支持 反对

使用道具 举报

 楼主| 发表于 2026-7-5 18:40:30 | 显示全部楼层
可控左右滚动菜单视图列表,支持手机触摸左右滚动
模板:wqych
PC:区别于wqych-move,自动左滚动

MB:


DIV:

CSS:

JS:


回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-8-4 09:07 , Processed in 0.100549 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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