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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:37:45+00:00 2026-06-17T06:37:45+00:00

I do hope my question fits here, because I read the FAQ but it

  • 0

I do hope my question fits here, because I read the FAQ but it isn’t clear to me whether I should run code errors here. Anyway, this snippet (extracted from a project I work on) is giving me a hard time. When checking in JSFiddle it tells me that it expected } for closing the animate({ but instead found 300, but that doesn’t make sense because there is nothing to match, animate is already closed.

Console then, tells me that the comma before 300 was unexpected. I really don’t understand the problem with it!

var condition = offL > ((wW / 2) - $this.width()),
  propertiesAnim = [],
  propertiesCss = [];

if (condtion) {
  properties = "'left': offL - tooltip.width() - 25";
  propertiesCss = "'right', 'auto'";
} else {
  properties = "'right': offR - tooltip.width() - 25";
  propertiesCss = "'left', 'auto'";
}

tooltip.stop(true).css(propertiesCss).text(title).animate({
  "top": ($this.offset().top + (posT / 2) - (tooltip.height() / 2)),
  properties
}, 300).fadeTo(200, 1); // Error
  • 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-17T06:37:46+00:00Added an answer on June 17, 2026 at 6:37 am

    You can neither add to a “property” list nor insert variables into strings like that.

    Firstly, use correct object literal syntax to fill your properties (which need to be declared as objects, not arrays)

    var properties = {}, css = {};
    
    if (condtion) {
        properties = { left: offL - tooltip.width() - 25 };
        css = { right: 'auto' };
    } else {
        properties = { right: offR - tooltip.width() - 25 };
        css = { left: 'auto' };
    }
    

    and then, use $.extend to add new properties to an existing object, or just add the required value directly, i.e.

    $.extend(properties, {
        top: $this.offset().top + (posT / 2) - (tooltip.height() / 2)
    });
    

    or:

    properties.top = $this.offset().top + (posT / 2) - (tooltip.height() / 2);
    

    then:

    ...animate(properties);
    

    $.extend() is preferred if you already have one set of object properties and want to merge the contents of another. For just adding one property the latter method is simpler.

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

Sidebar

Related Questions

I hope this question isn't too open ended, but a nudge in the right
I hope this question will not be rejected as there is no code. But
I hope this question isn't duplicating something in the archives; I've looked but can't
I hope my question is clear from the title. But still I will explain
I hope the question is clear enough. Here's my query: SELECT 'Total Complete' AS
i do hope this question fits here, otherwise sorry. I have a physical alarm
I hope this question isn't too broad, but then again I would expect the
I hope the question isn't too vague but I was wondering if running 'Refresh'
I hope this question isn't too general. Well, the situation is that I am
I hope this question isn't too dumb. We have many websites internally that need

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.