Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

135
Views
I want the Sticky Sidebar to stop in the Footer. How can I do it?

I need help with sticky sidebar. I want the sidebar to stop when it comes to the footer, how can I do it?

The id I will use for the footer. #endOfTheFooter I tried this a lot. But I could not be successful because I have very little coding knowledge. Please help me

//making sidebars fix to screen top.
 var setStickySidebar = function(){
//if window screen < 960 sidebar hiding.
if (window.outerWidth > 960)
{
    var sidebar = $('.sidebar_inner');
    var sidebarHeight = sidebar.outerHeight();
    var windowHeight = $(window).height();
    var wrapperTopPos = $('.main-content').position().top;
    var scrollTop = $(this).scrollTop();

    if ((sidebarHeight+30) < windowHeight)
    {
        if ((scrollTop+30) > wrapperTopPos)
            sidebar.css({'position':'fixed', 'top':30});
        else
            sidebar.css({'position':'absolute', 'top':0});
    }
    else
    {
        if (scrollTop > (wrapperTopPos+30+sidebarHeight-windowHeight))
            sidebar.css({'position':'fixed', 'top':-(sidebarHeight+30-windowHeight)});
        else
            sidebar.css({'position':'absolute', 'top':0});

    }

    if ($('.article-left-box-inner').length)
    {

        var leftSidebar = $('.article-left-box-inner');
        var leftSidebarH = leftSidebar.outerHeight();
        var endOfTheArticlePos = $('#endOfTheArticle').offset().top;

        if ((scrollTop+30) > wrapperTopPos)
        {
            if ((scrollTop+leftSidebarH+80) > endOfTheArticlePos)
                leftSidebar.css({'position':'absolute', 'top':'auto', 'bottom':10});
            else
                leftSidebar.css({'position':'fixed', 'top':70, 'bottom':'auto'});
        }
        else
            leftSidebar.css({'position':'absolute', 'top':0, 'bottom':'auto'});

        
     }
   }
  }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!