简体   繁体   English

粘性侧边栏在页脚之前不会停止

[英]sticky sidebar doesn't stop before footer

I have problem when i build my blog, there something i want to know how to make my sidebar widget sticky and stop scroll before #footer 当我构建我的博客时,我有问题,我想知道如何让我的侧边栏小部件粘贴并在#footer之前停止滚动

How do I make it stop before footer? 如何在页脚之前停止? My widget is going through my footer and I really appreciate if someone can help me, and for sure other people have the same question. 我的小部件正在通过我的页脚,我真的很感激,如果有人可以帮助我,并确保其他人有同样的问题。

this a script : 这是一个脚本:

 <script> // Sticky widget by Bloggersentral.com // Tutorial at http://www.bloggersentral.com/2013/04/how-to-make-any-widget-sticky.html // Free to use or share, but please keep this notice intact. //<![CDATA[ bs_makeSticky("YOUR_WIDGET_ID"); // enter your widget ID here function bs_makeSticky(elem) { var bs_sticky = document.getElementById(elem); var scrollee = document.createElement("div"); bs_sticky.parentNode.insertBefore(scrollee, bs_sticky); var width = bs_sticky.offsetWidth; var iniClass = bs_sticky.className + ' bs_sticky'; window.addEventListener('scroll', bs_sticking, false); function bs_sticking() { var rect = scrollee.getBoundingClientRect(); if (rect.top < 0) { bs_sticky.className = iniClass + ' bs_sticking'; bs_sticky.style.width = width + "px"; } else { bs_sticky.className = iniClass; } } } //]]> </script> 
 <style> .bs_sticking {background:#f2f2f2 !important; position:fixed !important; top:0; z-index:9999; box-shadow:0px 10px 4px -5px rgba(0,0,0,0.3); margin-top: 0; position:relative\\9 !important;} </style> 

Q : How do I make it stop before footer? 问:如何在页脚之前停止?

我的问题现在解决了,解决方案在这个链接中 ,但是,它也不会很完美,我只是在这个粘性侧边栏小部件的下方添加Jquery,并在主页上再添加一个Jquery for images滑块,最终全部去了好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM