Last active
October 10, 2017 12:31
-
-
Save VitalyKondratiev/364abc0a125c7585d4e2081042f33e1c to your computer and use it in GitHub Desktop.
Плавное "выезжание" блока при скролле страницы
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function (){ | |
$('.for-slidedown').addClass('slidedown-ready') | |
$(window).on('scroll', function (event) { | |
$('.for-slidedown.slidedown-ready').each(function () { | |
if (window.innerHeight + window.pageYOffset >= $(this).offset().top) { | |
$(this).removeClass('slidedown-ready'); | |
} | |
}); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Навесить класс `for-slidedown` на элементы, к которым следует применить эффект*/ | |
.for-slidedown { | |
transition: all 1s ease; | |
transform: translateY(-0px); | |
opacity: 1; | |
} | |
.slidedown-ready { | |
transform: translateY(-30px); | |
opacity: 0.2; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment