面板固定内容滚动

发布于 2025-01-16 05:17:34 字数 2200 浏览 2 评论 0原文

我正在尝试用 jQuery 和 ajax 做动态面板。

我的想法是,当我选择一个复选框时,执行我的 ajax 并返回带有此复选框的 category_id 的所有项目。我的所有过程都很好,但我的问题是我希望我的面板标题固定在我的模式中,并满足滚动-y 但我不能这样做。

这是我的代码:

// SET CATEGORY PRODUCT
$(".div-bag").append(`
                    <div class="container-offer-c" style="overflow-y: scroll; overflow-x: hidden; height: 150px; margin-bottom: 20px;">
                        <div class="panel-heading-offer bg-secondary"><span class="ml-3"> ARTICULOS C </span></div>
                    </div>
                `);

// LOOP TO GET ITEMS C
$.each(response[0], function(index, value) {
    $(".container-offer-c").append(`
                        <div class="container-offer-items" >
                            <div class="panel-heading-offer-items row align-items-center mt-2">
                                <div class="col-md-1 ml-2">
                                    <input type="checkbox" class="${ value.id } selectItem" value="${ value.id }">
                                </div>
                                <div class="col-md-2 ml-2">
                                    <span>${ value.codigo }</span>
                                </div>
                                <div class="col-md-4">
                                    <span class="size-font">${ value.nombre }</span>
                                </div>
                                <div class="col-md-2">
                                    
                                </div>
                                <div class="col-md-2">
                                    <input type="number" class="form-control" value="1" style="width: 100%; text-align:center">
                                </div>
                            </div>
                        </div>
                    `)

此代码导致:

在此处输入图像描述

但我需要修复我的面板,修复“ARTICULOS C”并使用滚动-y 修复他的内容

感谢您阅读我的内容,并对我的英语不好表示歉意

I'm trying to do dynamic panel in jQuery and ajax.

My idea is that when I select a checkbox execute my ajax and return all my items with category_id that have this checkbox. All my process is ok, but my problem is that I want my panel heading to be fixed in my modal, and content with scroll-y but I can't to do this.

This is my code:

// SET CATEGORY PRODUCT
$(".div-bag").append(`
                    <div class="container-offer-c" style="overflow-y: scroll; overflow-x: hidden; height: 150px; margin-bottom: 20px;">
                        <div class="panel-heading-offer bg-secondary"><span class="ml-3"> ARTICULOS C </span></div>
                    </div>
                `);

// LOOP TO GET ITEMS C
$.each(response[0], function(index, value) {
    $(".container-offer-c").append(`
                        <div class="container-offer-items" >
                            <div class="panel-heading-offer-items row align-items-center mt-2">
                                <div class="col-md-1 ml-2">
                                    <input type="checkbox" class="${ value.id } selectItem" value="${ value.id }">
                                </div>
                                <div class="col-md-2 ml-2">
                                    <span>${ value.codigo }</span>
                                </div>
                                <div class="col-md-4">
                                    <span class="size-font">${ value.nombre }</span>
                                </div>
                                <div class="col-md-2">
                                    
                                </div>
                                <div class="col-md-2">
                                    <input type="number" class="form-control" value="1" style="width: 100%; text-align:center">
                                </div>
                            </div>
                        </div>
                    `)

This code results in:

enter image description here

but I need that my panel fixed, "ARTICULOS C" fixed and his content with scroll-y

Thanks for read me and sorry for my bad English

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雨的味道风的声音 2025-01-23 05:17:34

我解决了添加新 div 的问题:

// SET CATEGORY PRODUCT
                        $(".div-bag").append(`
                                <div class="container-offer-1" style="overflow-y: scroll; overflow-x: hidden; height: 150px; margin-bottom: 20px;">
                                    <div class="panel-heading-offer bg-secondary"><span class="ml-3"> MANTENIMIENTO </span></div>
                                </div>
                                <div class="container-offer-items-secondary-maintenance" style="overflow-y: scroll; overflow-x: hidden;">
                                </div>
                        `);

I solved my problem adding a new div:

// SET CATEGORY PRODUCT
                        $(".div-bag").append(`
                                <div class="container-offer-1" style="overflow-y: scroll; overflow-x: hidden; height: 150px; margin-bottom: 20px;">
                                    <div class="panel-heading-offer bg-secondary"><span class="ml-3"> MANTENIMIENTO </span></div>
                                </div>
                                <div class="container-offer-items-secondary-maintenance" style="overflow-y: scroll; overflow-x: hidden;">
                                </div>
                        `);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文