EmpireWorld
همکار بازنشسته
این کدها که توی اسپویلر گذاشتی کدهای فعلی ای هست که توی قالبته یا نسخه تصحیح شده ی اونهاست؟دوستان طراح
@MOHAMMAD026_1
@EmpireWorld
, ...
قالبی که فرستادیم soft-reject شده و چندتا گیر داره
1. REDUNDANT JAVASCRIPT EVENTS: There are currently redundant events in your JavaScript. For example, you have multiple $(document).ready() events or multiple $(window).load() events. Please consolidate all code that should occur within a single event.
این چیزی که نوشته یعنی چی؟ من ۱۵ تا فایل js دارم که توی خیلی هاش از document).ready و یا window).load و ... استفاده شده، منظورش ان بوده که فقط و قط مجاز هستم یکبار ازشون استفاده کنم؟ یا توی هر فایل یک بار ؟ (کدهای نمونه آخر پست ببینید)
2. STRICT MODE REQUIRED: All JavaScript should be written with “use strict” mode on. Please note that strict mode is scoped. For concise code it is recommened to placed
استفاده از use strict چطور باید باشه؟ مثلا فایل زیر یکی از فایل های js منه، باید فقط یکبار توی این فایل ازش استفاده کنم
HTML:// Counter called $('.counter').counterUp({ delay: 1, time: 300 }); // Lazy Image called $(function() { $('.lazy').lazy(); }); // swipebox called [pop up image] $( '.swipebox' ).swipebox({ hideBarsDelay : 9000 }); // Owl Slider called and Option $('#owl-header').owlCarousel({ items: 1, navContainerClass:'owl-nav container', dotsClass:'owl-dots container', loop:true, navigation:true, nav:true, autoplay:true, autoplayTimeout:7000, autoplayHoverPause:false, animateOut: 'slideOutLeft', animateIn: 'slideInRight', navText: ['<i class="fa fa-arrow-circle-left"></i>','<i class="fa fa-arrow-circle-right"></i>'], }); // Owl Slider called and Option $("#owl-clients").owlCarousel({ autoPlay: 5000, //Set AutoPlay to 3 seconds nav:false, dots:false, items:6, loop:true, autoplay:true, autoplayHoverPause:false, responsiveClass:true, responsive: { 0: { items: 3, }, 767: { items: 4, }, 991: { items: 5, }, 1199: { items: 6, } } }); // Owl Slider called and Option $("#owl-quotes").owlCarousel({ nav:false, dots:true, items:1, loop:true, autoplay:true, autoplayHoverPause:false, animateOut: 'slideOutLeft', animateIn: 'slideInRight', autoplayTimeout:7500, }); // stellar called [Parallax Option] var isMobile = { Android: function() { return navigator.userAgent.match(/Android/i); }, BlackBerry: function() { return navigator.userAgent.match(/BlackBerry/i); }, iOS: function() { return navigator.userAgent.match(/iPhone|iPad|iPod/i); }, Opera: function() { return navigator.userAgent.match(/Opera Mini/i); }, Windows: function() { return navigator.userAgent.match(/IEMobile/i); }, any: function() { return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); } }; jQuery(document).ready(function(){ jQuery(window).stellar({ horizontalScrolling: false, hideDistantElements: true, verticalScrolling: !isMobile.any(), scrollProperty: 'scroll', responsive: true }); }); // Wow Called wow = new WOW( { boxClass: 'wow', // default animateClass: 'animated', // default offset: 50, // default mobile: true, // default live: true // default } ); wow.init(); // shuffleme Called [animation filtering image] var shuffleme = (function( $ ) { 'use strict'; var $grid = $('#grid'), //locate what we want to sort $filterOptions = $('.portfolio-sorting li'), //locate the filter categories $sizer = $grid.find('.shuffle_sizer'), //sizer stores the size of the items init = function() { // None of these need to be executed synchronously setTimeout(function() { listen(); setupFilters(); }, 100); // instantiate the plugin $grid.shuffle({ itemSelector: '[class*="col-"]', sizer: $sizer }); }, // Set up button clicks setupFilters = function() { var $btns = $filterOptions.children(); $btns.on('click', function(e) { e.preventDefault(); var $this = $(this), isActive = $this.hasClass( 'active' ), group = isActive ? 'all' : $this.data('group'); // Hide current label, show current label in title if ( !isActive ) { $('.portfolio-sorting li a').removeClass('active'); } $this.toggleClass('active'); // Filter elements $grid.shuffle( 'shuffle', group ); }); $btns = null; }, // Re layout shuffle when images load. This is only needed // below 768 pixels because the .picture-item height is auto and therefore // the height of the picture-item is dependent on the image // I recommend using imagesloaded to determine when an image is loaded // but that doesn't support IE7 listen = function() { var debouncedLayout = $.throttle( 300, function() { $grid.shuffle('update'); }); // Get all images inside shuffle $grid.find('img').each(function() { var proxyImage; // Image already loaded if ( this.complete && this.naturalWidth !== undefined ) { return; } // If none of the checks above matched, simulate loading on detached element. proxyImage = new Image(); $( proxyImage ).on('load', function() { $(this).off('load'); debouncedLayout(); }); proxyImage.src = this.src; }); // Because this method doesn't seem to be perfect. setTimeout(function() { debouncedLayout(); }, 500); }; return { init: init }; }( jQuery )); $(document).ready(function() { shuffleme.init(); //filter portfolio }); // Option | Preloader $(window).load(function() { // makes sure the whole site is loaded $("#status").fadeOut(); // will first fade out the loading animation $("#preloader").delay(500).fadeOut("slow"); // will fade out the white DIV that covers the website. })
مورد اولش میگه event ها اضافی داری. یعنی مثلا $(document).ready() رو که شروع میکنی همه توابع مورد نظرت رو اجرا کن
در کل میگه همه توابع جاوا رو یکی کن و ببر توی یک فایل
مورد دوم رو هم نمیدونم