Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7828593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:24:35+00:00 2026-06-02T10:24:35+00:00

Good morning, I am currently finishing a project: http://schaedlingsbekaempfer24.eu/ After embeding a little bit

  • 0

Good morning,

I am currently finishing a project: http://schaedlingsbekaempfer24.eu/

After embeding a little bit of javascript for a simple self calling fadeOut/fadeIn effect, page load time increased by four to five seconds.

This is my js:

$(document).ready(function() {

    pic = $(this).find('.picture a:nth-child(2n) img');
    text = $(this).find('#testimonal p:first-child').next();

    $.fn.fader = function() {

        $(pic).delay(5000).fadeOut(300);
        $(text).delay(5000).fadeOut(300);

        $(pic).delay(5000).fadeIn(300);
        $(text).delay(5000).fadeIn(300);

        $(this).fader();
    };

    setTimeout(function() {    
      $('#preview').fader();
    }, 2000);

});

It seems like the function is executed from the very first moment the site is starting to load. How can I tweak my code for better loading performance?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T10:24:37+00:00Added an answer on June 2, 2026 at 10:24 am

    Best fix is to move the set timeout inside the function, this way you avoid the recursion hammering and you spawn a fade call only once every 5 secs.

    Right now you are akilling your browser forcing it in an endless recursion call.

    If put a console.log(‘called’) inside your fader function you will be surprised!

    There are also minor improvements you can do but they are really really minor compared to your first problem:

    1- move $.fn.fader definition after jquery load and before the document ready callback function

    2- cache your selectors eg.

    var $this = $(this);
    $this.delay(1000).fadeIn(300);
    $this.delay(1000).fadeOut(300);
    

    Again, this are very minor performances tweaks compared to your big optimization issue and are not going to give decent performance in itself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A very good morning, i am currently working on a simple php project, the
Good morning everyone, I'm currently building a jquery step by step form at: http://jsfiddle.net/xSkgH/
Good morning, I am currently working on a project in which I need to
Good morning, I am currently working on a project that utilises Codeigniter and the
Good Morning everyone I'm currently facing a segfault at random on a little piece
Good morning. I currently have this little rule in my .htaccess RewriteEngine On RewriteBase
Good morning, I am currently writing a python library. At the moment, modules and
Good Morning, Im using the Google Maps V3 to implement a project. In my
Good morning, I have to use the properties from DeviceNetworkInformation in my application. (http://msdn.microsoft.com/en-us/library/microsoft.phone.net.networkinformation.devicenetworkinformation(v=vs.92).aspx)
Good morning, I've got an ASP.NET MVC VB2008 .NET 3.5 project I'm upgrading to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.