Show Div when scroll position

Basically, you want to add a “hideme” class to every element you want hidden (then you set that class to “opacity:0”; Then, using jQuery you set a $(window).scroll() event to check the location of the bottom of every “hideme” element against the bottom edge of your visible window. Here’s the meat of it … /* … Read more

Animate scroll to ID on page load

You are only scrolling the height of your element. offset() returns the coordinates of an element relative to the document, and top param will give you the element’s distance in pixels along the y-axis: $(“html, body”).animate({ scrollTop: $(‘#title1’).offset().top }, 1000); And you can also add a delay to it: $(“html, body”).delay(2000).animate({scrollTop: $(‘#title1’).offset().top }, 2000);

Correct way to animate box-shadow with jQuery

Direct answer Using Edwin Martin’s jQuery plugin for shadow animation, which extends the .animate method, you can simply use the normal syntax with “boxShadow” and every facet of that – color, the x- and y-offset, the blur-radius and spread-radius – gets animated. It includes multiple shadow support. $(element).animate({ boxShadow: “0px 0px 5px 3px hsla(100, 70%, … Read more

jQuery .scrollTop(); + animation

To do this, you can set a callback function for the animate command which will execute after the scroll animation has finished. For example: var body = $(“html, body”); body.stop().animate({scrollTop:0}, 500, ‘swing’, function() { alert(“Finished animating”); }); Where that alert code is, you can execute more javascript to add in further animation. Also, the ‘swing’ … Read more

Scroll smoothly to specific element on page

Super smoothly with requestAnimationFrame For smoothly rendered scrolling animation one could use window.requestAnimationFrame() which performs better with rendering than regular setTimeout() solutions. A basic example looks like this. Function step is called for browser’s every animation frame and allows for better time management of repaints, and thus increasing performance. function doScrolling(elementY, duration) { var startingY … Read more