From 9e0ae6cd928cd12028ebc895f4617193b18ee7b1 Mon Sep 17 00:00:00 2001 From: James Russell Date: Mon, 7 Dec 2015 20:41:26 -0500 Subject: [PATCH] Simplify landing elements logic Removes extra dom query in favor of passing the current element in the iteration into the function. Also removes the eq call since that is taken care of by the iteration itself. --- js/functions.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/functions.js b/js/functions.js index f20002f..09f41e8 100644 --- a/js/functions.js +++ b/js/functions.js @@ -24,10 +24,10 @@ $(window).scroll(function(){ // Landing Elements if(wScroll > $('.clothes-pics').offset().top - ($(window).height() / 1.2)) { - $('.clothes-pics figure').each(function(i){ + $('.clothes-pics figure').each(function(i, figure){ setTimeout(function(){ - $('.clothes-pics figure').eq(i).addClass('is-showing'); + $(figure).addClass('is-showing'); }, (700 * (Math.exp(i * 0.14))) - 700); });