view raw
Honzis Novák Honzis Novák - 1 year ago 64
Javascript Question

Change value of div while scrolling

how could I change a position of a div, based on scroll level of my website? I have a landing screen (whole page fullscreen background) only with big centered logo. What I'm asking is, how to do that it'll scale down and catch into a navbar, where it'll be sticked, untill it would be scrolled up again.

I did a video showcase, how I mean it.

I'm so glad for any help, have a nice day, senior coders! :)


Check the

var aDivPosition = $('.adivclass').height();
if ($(this).scrollTop() >= aDivPosition) {
      my: bottom,
      of: $window,
          collision: "fit"

The fiddle only has the needed code. You will have to work out the .position method if not, post back your update (with your code).