我们在wordpress主题开发过程中会给网站设置双栏或者三栏,有时候边栏内容很多时,用户看不完边栏内容会影响内容传播,那么我们需要既要让边栏永驻又得让边栏的内容全部展现在用户可见的区域里,怎么办?

模板兔推荐大家使用一款jQuery插件,Theia Sticky Sidebar,具体介绍:https://github.com/WeCodePixels/theia-sticky-sidebar。

使用方法

<div class="post-content">文章主要内容</div>

<div class="sidebar">

    <div class="theia-Sticky-Sidebar">边栏内容</div>

</div>

if($('.sidebar').length){
        $('.theia-Sticky-Sidebar').theiaStickySidebar({"containerSelector":".post-content","additionalMarginTop":"99px"});
}