2
0
mirror of https://github.com/offen/website.git synced 2024-10-18 20:20:24 +02:00

prevent out of bounds opacity values

This commit is contained in:
Frederik Ring 2019-08-30 14:07:24 +02:00
parent b493f1c8f8
commit 8f5bc24fd1

View File

@ -1,7 +1,8 @@
;(function ($) { ;(function ($) {
$(document).ready(function () { $(document).ready(function () {
$(window).scroll(function () { $(window).scroll(function () {
$('.brand-index').css('opacity', 0 + $(window).scrollTop() / 100) var scrollProgress = parseInt($(window).scrollTop(), 10)
$('.brand-index').css('opacity', Math.min(scrollProgress / 100, 1))
}) })
}) })
})(window.jQuery) })(window.jQuery)