侧边栏滚动问题

问题描述 投票:0回答:1

我的问题是我想以某种方式修复网站上的侧边栏通过滚动https://helloacademy.co/course/the-complete-digital-marketing-course/更改其位置,我希望将其固定在顶部

最初,我使用此CSS进行修复。但是还有更好的解决方案吗?

.course_header5_sideblock {
    transform: translateY(0px)!important;
}  
jquery css wordpress sidebar
1个回答
0
投票

影响侧边栏的JavaScript代码在wplms.min.js中,如mark.hch注释。

您的CSS解决方案可能是实现解决方案的最简单方法,除非您在使用!important时遇到问题,否则似乎很好。

也就是说,如果您想直接编辑JS文件并删除此功能,则需要删除此代码段:

    var e = function() {
        t(".course_header5_sideblock").each(function() {
            if (Math.max(document.documentElement.clientWidth, window.innerWidth || 0) > 992) {
                var e = t(this).parent().width(),
                    n = (t(".pusher > .fix").height(), t("#content").offset().top + t("#content").height() - t(this).height());
                t(this).css("width", e + "px");
                var i = t(this);
                t(window).scroll(function(e) {
                    var o = t(this).scrollTop();
                    o < n && i.css("transform", "translateY(" + o + "px)")
                })
            } else t(this).css("width", "")
        })
    };

漂亮打印时,此代码段位于5267-5280行。

注意,当/如果您更新WPLMS插件,此编辑将被覆盖,因此CSS可能是最好的解决方案。

© www.soinside.com 2019 - 2024. All rights reserved.