Click here to Skip to main content
15,886,578 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm trying to make a very fluid page that is similar to https://www.apple.com/macbook-pro/ . If you take a look, you can see that when you scroll up the words on the first banner become more visible and ascend to the top from the bottom. Does anyone know how to make this effect possible or what language I would use to code it? My goal is to have a similar first "p" section on a website I'm working on.

What I have tried:

I've inspected the page for countless hours and have been snipping code left and right. But I can't get that first "p" div to show up and I can't get the flowing and opacity effect of the letters.
Posted
Updated 24-Jul-18 3:24am

1 solution

By using JavaScript this can achievable. Based on scroll of window opacity value need to change. As per apple URL initially its 0.35 opacity when its scrolling its change to 1.

use this URL for reference ScrollMe - For simple scrolling effects[^]

try something like below

var divs = $('.social, .title'),
    limit = 35;  /* scrolltop value when opacity should be 0 */

$(window).on('scroll', function() {
   var st = $(this).scrollTop();

   /* avoid unnecessary call to jQuery function */
   if (st <= limit) {
      divs.css({ 'opacity' : (1 - st/limit) });
   }
});
when scrolltop reaches 35px then opacity of divs is 1 - 35/35 = 0
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900