Can't Figure jQuery Object Cache Issue

My recent submission (HTML5 Template) got soft rejected for CACHE JQUERY OBJECTS but, as I already coded in optimized way (from my past experience) I could not see any object I am using repeatedly without caching. Here is my JS file: https://www.dropbox.com/s/afwvtgsxxb2xnc9/main.js?dl=0
Can anyone help me to figure out the specific code block, that I messed?

Thanks in Advance :slight_smile:

Try to avoid repetitions like this:

$('#new-products').find('.owl-prev').html('<i class="fa fa-angle-left"></i>');
$('#new-products').find('.owl-next').html('<i class="fa fa-angle-right"></i>');

Instead use:

var newProducts = $('#new-products');
newProducts.find('.owl-prev').html('<i class="fa fa-angle-left"></i>');
newProducts.find('.owl-next').html('<i class="fa fa-angle-right"></i>');

Also window object is repeating:

$(window).on(‘load’, function() {
$(window).on(‘load’, function() {

Instead you can use:

var window = $(window);
window.on('load', function() {
window.on('load', function() {
3 Likes

Hi @DeoThemes,

Thank you so much!. I am going to fix them right now :slight_smile: