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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:10:15+00:00 2026-05-20T10:10:15+00:00

EDIT: Never mind. Figured out the issue. Just made height an array and name

  • 0

EDIT: Never mind. Figured out the issue. Just made height an array and name each id. Der. thanks anyway.

I’ve searched and not turned up much on this. I’ve got a simple script that just animates a drop down menu sliding out when hovered over. The issue is if I quickly move back and forth between two or more of the menu items the height variable I set at the begin of each hover can be overwritten. I’ve got a work around that fixes it after moving off and then back on again by resetting the height to auto when it’s off screen but I wont to prevent it from happening at all. Usually I would make a dynamic avariable in other languages I’ve worked in like:

$height = $(this).attr("id")+"height";

alert($$height);

//which would theoretically alert the height of whatever triggered it. 

Is there a way to do this in jQuery so each element that calls the function has it’s own height variable?

EDIT2: Since there is interest I’ll paste the whole thing.

   $("#NavMenu > li").hover(
           function () {
               var height = {};
               height[$(this).attr("id")] = $(this).find("ul").css("height");
               $(this).find("ul").css("height", "0px");
               $(this).find("ul").css("left", "auto");
               $(this).find("ul").animate({ height: height[$(this).attr("id")] }, 300)
           },
            function () {
                $(this).find("ul").css("left", "-999em");
                $(this).find("ul").css(height, height[$(this).attr("id")])
            }
        )
  • 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-20T10:10:16+00:00Added an answer on May 20, 2026 at 10:10 am

    Yes, you can do that:

    $('.obj').get(0).key = 'value';
    

    or

    $('.obj').get(0)['key'] = 'value'
    

    Though it’s better to use .data():

    $('.obj').data('key', 'value');
    

    Tips

    1. You can chain multiple calls, like this:

    $('.obj').css('color', 'red').data('key', 'value');
    

    2. You can pass an object to .css():

    $('.obj').css({
        'width': 100,
        'height': 100
    });
    

    3. If you don’t change other CSS properties, you can use .width()and .height() to set and get an element’s width:

    HTML

    <div id='box'></div>
    

    CSS

    #box {
        width: 200px;
        height: 100px;
    }
    

    JavaScript

    var $box = $('#box');
    // 200x100
    alert( $box.width() + 'x' + $box.height() );
    

    4. You may have noticed in the previous example that I saved a reference to $('#box') in a variable. There are some cases when you can’t use chaining, like this:

    var $box = $('#box');
    setTimeout(function() {
        $box.animate({ 'width': 100 }, 100);
    }, 1000);
    setTimeout(function() {
        $box.animate({ 'height': 200 }, 100);
    }, 1000);
    

    If you have to do that, always save a reference to the element – that’s called caching. Otherwise jQuery would have to search for it multiple times.

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

Sidebar

Related Questions

EDIT: I have figured out my main issue, but still have one concern. Everything
I was just wondering, is Graphics.DrawImage() asynchronous? I'm struggling with a thread safety issue
Edit: This question was written in 2008, which was like 3 internet ages ago.
Edit: From another question I provided an answer that has links to a lot
EDIT: This was formerly more explicitly titled: - Best solution to stop Kontiki's KHOST.EXE
EDIT: Learned that Webmethods actually uses NLST, not LIST, if that matters Our business
EDIT: This question is more about language engineering than C++ itself. I used C++
EDIT What small things which are too easy to overlook do I need to
Edit : Solved, there was a trigger with a loop on the table (read
edit #2: Question solved halfways. Look below As a follow-up question, does anyone know

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.