Skip to content

Instantly share code, notes, and snippets.

@kenzo-tanaka
Created January 2, 2019 05:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenzo-tanaka/285adf5f53e32d170aa56bf7f552bd03 to your computer and use it in GitHub Desktop.
Save kenzo-tanaka/285adf5f53e32d170aa56bf7f552bd03 to your computer and use it in GitHub Desktop.
$(function(){
$(window).scroll(function(){
var windowHeight =$(window).height();
var windowTop =$(window).scrollTop();
$(".underline1").each(function(){
var objectImage =$(this).offset().top;
if(windowTop > objectImage - windowHeight*1/2){$(this).css("background-size","100% 100%")};
});
$(".underline2").each(function(){
var objectImage =$(this).offset().top;
if(windowTop > objectImage - windowHeight*1/2){$(this).css("background-size","100% 100%")};
});
$(".underline3").each(function(){
var objectImage =$(this).offset().top;
if(windowTop > objectImage - windowHeight*1/2){$(this).css("background-size","100% 100%")};
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment