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

  • Home
  • SEARCH
  • 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 8598793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:14:21+00:00 2026-06-12T01:14:21+00:00

I have a plugin structured according to the boiler plate suggested here: http://markdalgleish.com/2011/05/creating-highly-configurable-jquery-plugins/ the

  • 0

I have a plugin structured according to the boiler plate suggested here:

http://markdalgleish.com/2011/05/creating-highly-configurable-jquery-plugins/

the plugin is responding as I want in Chrome, but I am getting Internet Explorer and FireFox errors

You can view the plugin in use here http://websonalized.com/myplugin.php

ERROR IN MSIE developer console (debugging):

Invalid argument myplugin.js, line 84 character 5

ERROR IN FIREFOX:

Error: useless setTimeout call (missing quotes around argument?)

setTimeout(animateSlide(sliderImage), 3000);

THIS IS THE RELEVANT BIT OF CODE

...

this.$slides.each(function(i){

    slide_config = $.extend({
        duration: 3000,
        squares: 225, //it will display the closest 'perfect square' number of tiles
        transition: 'linear'
    }, $(this).data());

    var sliderImage = $(this).find('.slidebg');

    ...

    setTimeout(animateSlide(sliderImage), 3000);

    function animateSlide(s){
        console.log('ANIMATED IMAGE SLIDER ' + i);
        console.log(s); 

        $(s).show('explode', { pieces: slide_config.squares }, 5000);
    };

    ...

The errors are gone if I rewrite the setTimeout bit to:

...

this.$slides.each(function(i){

    slide_config = $.extend({
        duration: 3000,
        squares: 225, //it will display the closest 'perfect square' number of tiles
        transition: 'linear'
    }, $(this).data());

    var sliderImage = $(this).find('.slidebg');

    ...

    setTimeout(function(){$(sliderImage).show('explode', { pieces: slide_config.squares }, 5000);}, 3000);              


    ...

But the value of slide_config.squares does not correspond to the this instance, and rather the value is the one set by the last slide data

this.$slides.each(function(i){

    slide_config = $.extend({
        duration: 3000,
        squares: 225, //it will display the closest 'perfect square' number of tiles
        transition: 'linear'
    }, $(this).data());

I imagine this has to do with context. can anyone help me fix and understand how should I use setTimeoff?

Fix means I am able to setTimeout w/o errors in browsers FF, IE and Chrome while the slide_config.squares value for each instance equals either the one set by each slide object or the defaults (i.e. slide_default )

NOTE: with the first code sample the value of slide_config.squares is what I expected, i.e. set according to slide object or slide_config defaults. Again, the code appears to work fine in Google Chrome with first bit of code

  • 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-12T01:14:22+00:00Added an answer on June 12, 2026 at 1:14 am

    You need to declare slide_config as a local variable within the each() callback by writing

    var slide_config = ...;
    

    This will give each setTimeout closure its own copy of the variable, rather than having them all share a global.

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

Sidebar

Related Questions

I'm trying to setup the Widget plugin by wiredesignz at http://codeigniter.com/forums/viewthread/109584/P20 but I keep
I have just developed a wordpress plugin and it is all structured within a
I have a system for which I am creating a plugin through a well
I am working on creating a jQuery plugin and I have some questions regarding
I have silverlight plugin on my page and some functionality to show panel as
I have a plugin where the original code is ... // when the DOM
I have a plugin that is loaded by this application.. This plugin calls some
We have a plugin system on a WCF service that checks libraries placed in
I have this plugin advImage which I use in tinyMce. I want the user
I have a plugin for uploading files using jquery uploadify. After calling a method

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.