I got a soft-rejected based on these two reasons:
- CACHE JQUERY OBJECTS: Please cache your jQuery selectors to improve performance: https://jsperf.com/why-cache-jquery-selectors
- $(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
1 Like
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.
What about this one?
CACHE JQUERY OBJECTS: Please cache your jQuery selectors to improve performance: https://jsperf.com/why-cache-jquery-selectors
1 Like
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!
2 Likes
Thanks! But I need one more to be clear. What should I do more with this one?
navbar.find(‘li’).each( function() { … });