var needScrollPrompt = 0; var testimonialsStart = $('.small-testimonial-wrapper:first'); var scrollPrompt = $('#scroll-prompt'); var topTestimonial = $(".large-img-wrapper"); $(function(){ /* bind any throttled event */ BindEvents(); /* adds a css class to smaller images does this so that media queries can be applied to them */ $('.testimonial-image-holder').each(function(){ if($(this).height() < 280){ $(this).addClass("small-testimonial-fixer"); } }); /* check to see if need a prompt to scroll */ TestimonsShowScroll(); /*RetinaCheck();*/ }); function BindEvents(){ window.addEventListener("optimizedScroll", function(){ ScrollPrompt(); }); } function TestimonsShowScroll(){ if(testimonialsStart.offset().top > $(window).height()){ needScrollPrompt = 1; scrollPrompt.css("opacity","1"); } } function ScrollPrompt(){ if( needScrollPrompt = 1){ console.log($(document).scrollTop()); if($(document).scrollTop() > 250){ scrollPrompt.css("opacity","0"); } else { scrollPrompt.css("opacity","1"); } } } /* function RetinaCheck(){ if(window.devicePixelRatio >= 2 || document.body.clientWidth > 1940){ pwlImage = new Image(); pwlImage.onload = function(){ topTestimonial.css("background-image", 'url(' + pwlImage.src + ')'); }; pwlImage.src = "./upload/images/testimonials/36/36_main_size3.jpg"; } } */