侧边栏滚动问题

时间:2019-10-24 20:13:10

标签: jquery css wordpress sidebar

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

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

.course_header5_sideblock {
    transform: translateY(0px)!important;
}  

1 个答案:

答案 0 :(得分:1)

影响侧边栏的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可能是最好的解决方案。

相关问题