Need help with two Js issues in soft-rejected please.

html
themeforest
item-feedback

#1

I got a soft-rejected based on these two reasons:

  1. CACHE JQUERY OBJECTS: Please cache your jQuery selectors to improve performance: https://jsperf.com/why-cache-jquery-selectors
  1. $(function() {}) is a shorthand for $document.ready(), you are calling this function concurrently.

==============================================================================

This is my item: http://www.crenoveative.com/envato/togoby/

Very appreciated


#2

Your can add your all code js where
"//ADD YOUR CODE JS HERE"

jQuery(document).on(‘ready’, function ($) {
“use strict”;

//ADD YOUR CODE JS HERE

}(jQuery));


Regards. :slight_smile:


#3

What about this one?

CACHE JQUERY OBJECTS: Please cache your jQuery selectors to improve performance: https://jsperf.com/why-cache-jquery-selectors


#4

What about this one?

CACHE JQUERY OBJECTS: Please cache your jQuery selectors to improve performance: https://jsperf.com/why-cache-jquery-selectors


#5

Reviewer has give you clear messages. You should do

var $window = $(window),
      navbar = $("#navbar");

if ( $window.width() > 992 ) {
    // bla bla bla
} 

$window.scroll(function() { });

navbar.find('li').each( function() { ..... });

instead calling those objects multiple times

if ( $(window).width() > 992 ) {
     .......
}

$(window).scroll(function(){
  ......
});

good luck!


#6

Thanks! But I need one more to be clear. What should I do more with this one?

navbar.find(‘li’).each( function() { … });