Sidebar Sticky Issue
-
I am using the following jQuery code to make my sidebar sticky just like WordPress sticky plugin.
<script> function sticky_relocate() { var window_top = $(window).scrollTop(); var div_top = $('#sticky-anchor').offset().top; if (window_top > div_top) { $('#sticky').addClass('stick'); } else { $('#sticky').removeClass('stick'); } } $(function() { $(window).scroll(sticky_relocate); sticky_relocate(); }); </script> /****** CSS *******/ sticky.stick { position: fixed; top: 35px; z-index: 1; width: 306px; margin: 0 auto; margin-bottom: 0; margin-left: 27px; margin-right: auto; padding: 25px 40px; }Issue: I want it to stop scrolling when it gets to footer or bottom of the sample ESA letter page, but it starts overlapping with footer.
I think I have to measure number of scrolls but don’t know how to implement it.
Any examples?-
This topic was modified 6 years, 11 months ago by
Steven Stern (sterndata).
-
This topic was modified 6 years, 11 months ago by
-
Hello Julia,
Is this the same site you are looking for help with? Also if you can provide us the screenshot it will help us understand the exact issue.
The site shared doesn’t have a sidebar, so which is the area you are talking about.
Can you please share that with us.
Thanks.
Kartik I just checked and my sample page issue is resolved. However this issue is persisting in my blog pages. Please help me in sorting out this issue.
Cheers
JuliaHow did you resolve the issue @julianderson671 ? We need to know why that resolution isn’t working for the other Blog pages. I have checked one of your blog pages and the issue doesn’t persist for me, can you try clearing your browser’s cache?
I asked my developers team to check out the issue as I am already stressed out with this irritating problem. They sorted out this issue buy correcting page coding and removed the sticky note but now they are unable to identify issue in blog pages. I need an expert advice so that I can get it fixed right away.
Thanks
Julia-
This reply was modified 6 years, 11 months ago by
Julia Anderson.
We’re happy to help, but we need more steps outlining how to replicate the problem.
I am explaining that when you scroll down till the end of any blog page, a sticky note overlaps with the footer. This issue occurs on media query less than 1200 pixels. I am unable to share the screen shot here. Please scroll down in any of the blog pages till the end.
Got it. Your monitor must be of a certain height before you can see the issue.
I don’t understand how this Sticky sidebar will ever work. Can you consider not using it? It’s going to suck a lot of development and resource time and for little impact.
Let me elaborate when I say:
It’s going to suck a lot of development and resource time and for little impact.
To build in logic that says “On scroll, track the position of the sidebar and the footer, check whether the bottom of the sidebar touches the footer, and then stop the JS that enabled the sticky sidebar” is quite a lot of work and it’s going to be a poorer experience for the user (because it will affect the browser’s performance).
The Web just wasn’t meant to be used in that way. The issue was introduced by using a script and some CSS. You should reconsider this approach rather than adding more code until it works.
Thank you very much for your support Andrew and I will try out considering your valuable professional tips.
Cheers!
Julia -
This reply was modified 6 years, 11 months ago by
The topic ‘Sidebar Sticky Issue’ is closed to new replies.