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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:31:13+00:00 2026-06-02T09:31:13+00:00

I have a curious problem with some javascript. In the following code the browser

  • 0

I have a curious problem with some javascript. In the following code the browser will execute more than one path in the if, else if, else if conditions. So for example the console will log “a c” or “b c”.

if (divs[i].row == hover_div.row && divs[i].obj != hover_div.obj)
{
    console.log("a");
    divs[i].obj.stop()
        .animate({'width':d_thin}, { duration:600, queue:false })
        .animate({'height':d_expand}, { duration:600, queue:false });
}
else if (divs[i].col == hover_div.col && divs[i].obj != hover_div.obj)
{
    console.log("b");
    divs[i].obj.stop()
        .animate({'width':d_expand}, { duration:600, queue:false })
        .animate({'height':d_thin}, { duration:600, queue:false });
}
else if (divs[i].obj != hover_div.obj);
{
    console.log("c");
    divs[i].obj.stop()
        .animate({'width':d_thin}, { duration:600, queue:false })
        .animate({'height':d_thin}, { duration:600, queue:false });
}

I’ve checked that the code isn’t executing twice by adding a counter just outside the block. If I nest the if statements as below the whole thing works fine, but I shouldn’t need to should I?

if (divs[i].row == hover_div.row && divs[i].obj != hover_div.obj)
{
    console.log("a");
    divs[i].obj.stop()
        .animate({'width':d_thin}, { duration:600, queue:false })
        .animate({'height':d_expand}, { duration:600, queue:false });
}
else {
    if (divs[i].col == hover_div.col && divs[i].obj != hover_div.obj)
    {
        console.log("b");
        divs[i].obj.stop()
            .animate({'width':d_expand}, { duration:600, queue:false })
            .animate({'height':d_thin}, { duration:600, queue:false });
    }
    else {
        if (divs[i].obj != hover_div.obj);
        {
            console.log("c");
            divs[i].obj.stop()
                .animate({'width':d_thin}, { duration:600, queue:false })
                .animate({'height':d_thin}, { duration:600, queue:false });
        }
    }
}
  • 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-02T09:31:19+00:00Added an answer on June 2, 2026 at 9:31 am
    else if (divs[i].obj != hover_div.obj); // <--
    

    delete the semicolon

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

Sidebar

Related Questions

I have another rather curious problem. I have the following structure: CREATE TABLE [dbo].[Event]
I have a curious problem with IE, IIS 6.0 dynamic PNG files and I
I have a curious problem: My app is distributed through ClickOnce. I recently installed
So, I am seeing a curious problem. If I have a function // counter
I'm curious how others have solved this problem, and what problems might lurk behind
I've encountered an curious problem while trying to use some objects through JSNI in
I have a curious little problem. I have a service that needs to create
I'm curious about how others have approached the problem of maintaining and synchronizing database
I have the following C# test code: class MyItem { MyItem( int a )
I encountered a problem when running some old code that was handed down 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.