Javascript Scrolling Footer Doesn't Work

Hey there!
A couple questions - I’m trying to make a scrollbar that pops up when someone scrolls to the bottom of my homepage and automatically pops up if there is no scrollbar. It seems to work on my safari but not on other people’s browsers, but I’m not too sure how to introduce fixes! Can someone help me out? My website is at 4ndygu.github.io.

Thanks!

This may be a bit simplistic but how about triggering the scroll on page load.

e.g. Try this:

$(function() {   
$(window).trigger("scroll");		
});

Assuming that’s what you meant :slight_smile:

Haha thanks Paul!

I guess I didnt want it to trigger on page load, but trigger if there were no scroll bar. If there were a scroll bar, it would trigger when someone scrolled to the bottom! It…works on my browser but not on Firefox at work.

Thanks!

Hi,

The trigger on page load is so that if there is not enough content to give you a vertical scrollbar the scroll routine is invoked and your code is run giving you a footer on pages that have no scrollbar (otherwise it would not appear).

If the page is long and has a vertical scrollbar the onload trigger does nothing yet because of the routune where you check the document height and so the footer won’t appear until its needed.

That seems to be exactly what you wanted and is working for me in Chrome and Firefox.

Maybe there is another issue that you are seeing if its only your local version that’s not working?

Oh cool, that makes a lot of sense!
I had a question though - I embedded that code into my function at load, and the onload trigger worked - I had a question though. Because the

$(document).ready(function() {   
    $(window).trigger("scroll");        
});

script runs whenever the document is loaded, i didn’t read the line as carefully. Thank you!

Is everything working ok now?

Yup. Thank you so much!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.