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 844201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:14:52+00:00 2026-05-15T06:14:52+00:00

I am trying to make a non interactive display for a real estate shop

  • 0

I am trying to make a non interactive display for a real estate shop window.

It’s been a while since I’ve played with setInterval().

The first time my script steps through, it is fine. But when it tries to get the next property via getNextProperty(), it starts to go haywire. If you have Firebug, or an equivalent output of console.log(), you’ll see it is calling things it shouldn’t!

Now there is a fair bit of JavaScript, so I’ll feel better linking to it than posting it all.

Store Display

Offending JavaScript

It is worth mentioning all my DOM/AJAX is done with jQuery.

I’ve tried as best to make sure clearInterval() is working, and it seems to not run any code below it.

The setInterval() is used to preload the next image, and then display it in the gallery. When the interval detects we are at the last image ((nextListItem.length === 0)), it is meant to clear that interval and start over with a new property.

It has been driving me nuts for a while now, so anyone able to help me?

It is probably something really obvious!

Many thanks!

Update

Well, now I feel better to know the problem was my naiveness of assuming plugins would work out of the box.

I did get this plugin from an answer on Stack Overflow. I have alerted the author of this question.

Thanks for all your answers!

  • 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-05-15T06:14:53+00:00Added an answer on May 15, 2026 at 6:14 am

    Here’s your problem area:

    jQuery.extend(jQuery, {
      imagesToLoad: 0,
    

    The problem is that this variable is global/shared (jQuery.imagesToLoad), so this check later on:

    if(jQuery.loadedImages.length >= jQuery.imagesToLoad){
    

    Depends on this plugin not being called twice at the same time, otherwise that if check goes nuts, since you’re calling this later in your code:

    $.preloadImages({
      urls: [nextImage],
    

    That count drops to 1, making the if evaluate to true not just on the last image, but all the images after the first in sets after the first (due to when the callback runs, it overlaps in time), which causes the complete callback to fire many times, not just once, so this code:

    $.preloadImages({
     urls: preloadImages,
     complete: function() { showProperty(property); }
    });
    

    …sees that complete function running many times, so you’re starting many intervals at the same time (this is why you see console.log('show property called' + property.slug) execute so many times in the log).

    Short fix: replace the preloadImages code with a version that doesn’t use a global variable 🙂

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

Sidebar

Related Questions

I've been trying to make a non-blocking TCP server of sorts using tcp::acceptor. I've
I've been trying to make a dict subclass inheriting from UserDict.DictMixin that supports non-hashable
Trying to make a toggle button that hides/shows the right window/pane. Here is a
After trying to make a while(bool) loop and it failing because I couldn't see
I'm trying to make non-blocking calls to 3 public APIs, i.e website A,B,C and
Im trying to make some text non-copyable, my aim isn't to stop people from
I'm trying to make an array of objects in random, non repeating order. Using
I'm trying to make a non-model form in ruby on rails, most of the
I am facing a class resolution issue while trying to make my architecture flexible.
I am trying to make my chunk of code non-thread-safe, in order to toy

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.