如何使hc

编程入门 行业动态 更新时间:2024-10-16 18:31:10
如何使hc-sticky插件重新访问其容器(How to make hc-sticky plugin to reffer to its container)

我的网站上安装了hc-sticky插件,我可以使用此代码使其适用于滚动侧边栏:

<script type="text/javascript"> jQuery(document).ready(function($){ $('.panel-rand').hcSticky({ stickTo: document, responsive: true, bottomEnd: 985, innerTop: 12, offResolutions: [-1200] }); }); </script>

但问题是你可以看到它在窗口的左侧是如何工作的(在这个链接: http : //www.cumseface.eu/viewtopic.php ?t = 91 ),当你滚动到底部,左边侧边栏不会在容器的末端停止滚动。有人可以帮我解决这个问题吗? 谢谢。

I have hc-sticky plugin installed on my website, I can use this code to make it work for a scrolling sidebar:

<script type="text/javascript"> jQuery(document).ready(function($){ $('.panel-rand').hcSticky({ stickTo: document, responsive: true, bottomEnd: 985, innerTop: 12, offResolutions: [-1200] }); }); </script>

But the problem is that you can see how it's working in the left side of the window (at this link: http://www.cumseface.eu/viewtopic.php?t=91 ), when you scroll until bottom, the left sidebar doesn`t stop scrolling at the end of the container in which is in. Can somebody help me to fix that ? Thank you.

最满意答案

您的容器是文档而不是父元素; 你通过'stickTo'选项设置它。 另外,'bottomEnd:985'意味着“当容器底部和棒块底部之间将是985px空间时,滚动将停止”。

因此,您需要将容器更改为具有所需滚动高度的元素。 最接近这个是'.post.bg2',但你在'.panel-rand'上面还有一些额外的块。 它们的总高度接近65px,因此我将bottomEnd设置为70以获得补偿。

尝试这个:

$('.panel-rand').hcSticky({ stickTo: '.post.bg2', responsive: true, bottomEnd: 70, innerTop: 12, offResolutions: [-1200] });

Your container is document not parent element; you set it via 'stickTo' option. In addition, 'bottomEnd: 985' means something like "scroll will stop when between container bottom and stick block bottom will be 985px space".

So you need to change container to element with desired scroll height. Closest to this is '.post.bg2', but you have some additional blocks above the '.panel-rand'. Their sum height is near 65px, therefore I set bottomEnd to 70 for compensation.

Try this:

$('.panel-rand').hcSticky({ stickTo: '.post.bg2', responsive: true, bottomEnd: 70, innerTop: 12, offResolutions: [-1200] });

更多推荐

本文发布于:2023-07-15 05:44:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1110762.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:hc

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!