CSS - Chrome - Apply gradual opacity to content when it scrolls up to the point where it disappears.

On this web page:

web page link

As the content page scrolls up, it disappears behind a <div>

before scrolling:
before disappear
during scrolling:
during scroll

My question is -- as the content approaches the area where it gets hidden, is there a way to have a gradual opacity div in place such that the content kind of begins to disappear gradually as it scrolls up?

Hope this makes sense.
LVL 5
Tom KnowltonWeb developerAsked:
Who is Participating?
 
Snarf0001Connect With a Mentor Commented:
You can try putting a gradient background instead of a flat white on your h1 element.
 The h1 #sectionTitle that has "Jackpacks" on the linked page, instead of:

background-color:#fff;

use

background:linear-gradient(to bottom, rgba(255,255,255,1) 40%,rgba(255,255,255,0) 100%);

Sine the position is fixed, as you scroll the page, the content underneath will be hidden under the sliding transparency.
You can play with the height of the element and the 40% vs 100% to adjust the gradient.
0
 
MishaConnect With a Mentor ProgrammerCommented:
If you want to hide element gradually, you can use jquerry:
$("#button").click(function(){ 
          $("#divID").fadeOut(3000,0.001)
});

Open in new window


If you want hide elemnt in scroll, you can use relevant event:
$('#target').scroll(function() {
  $("#divID").fadeOut(3000,0.001)
});

Open in new window

0
 
Tom KnowltonWeb developerAuthor Commented:
Excellent work.  Thanks to both of you!

Tom  :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.