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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:27:56+00:00 2026-05-23T03:27:56+00:00

I have a simple list and when I rollover the li selector I want

  • 0

I have a simple list and when I rollover the li selector I want to find the original height of the p tag inside that rollover scope that has a class of subtext. I want to store that value somewhere so I can use it on the rollout method. is there a way to store it in the this scope. If I use a global variable it may get changed by another rollover scope before the previous one gets to use it.

I also want to know how I can get the correct height of the selectors text height.
var pheight = $(this, “p.subtext”).height();
the above code is not reading the full height of the text. It seems to be reading the height of the li tag which in the css is set to height:50px;

li{
width: 100px;
height: 50px;
float: left;
color: #191919;
text-align: center;
overflow: hidden;
list-style-type: none;

}

HTML CODE

<body>
<ul>
    <li class="green">
        <div ></div>
        <p><a href="#">Home</a></p>
        <p class="subtext">The front page has more text than any other panel. I want the script to revel different height text.</p>
    </li>
    <li class="yellow">
        <p><a href="#">About</a></p>
        <p class="subtext">More info</p>
    </li>
    <li class="red">
        <p><a href="#">Contact</a></p>
        <p class="subtext">Get in touch</p>
    </li>
    <li class="blue">
        <p><a href="#">Submit</a></p>
        <p class="subtext">Send us your stuff!</p>
    </li>
    <li class="purple">
        <p><a href="#">Terms</a></p>
        <p class="subtext">Legal stuff</p>
    </li>
</ul>

$("document").ready(function(){

$("li").mouseover(function(){
    var pheight = $(this, "p.subtext").height();
    console.log(pheight);
    $(this).stop().animate({height:150}, {duration: 600, easing: "easeOutExpo"} );
})

$("li").mouseout(function(){
    $(this).stop().animate({height:50}, {duration: 600, easing: "easeOutExpo"} );
})

})

  • 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-23T03:27:57+00:00Added an answer on May 23, 2026 at 3:27 am

    First, you need to use the selector the other way round — $('p.subtext', this). More obviously, use find:

    var pheight = $(this).find('p.subtext').height();
    

    Then you can store the data on the element itself with data:

    $(this).data('pheight', pheight);
    

    You can retrieve it in the mouseout function with data again:

    $(this).stop().animate({height: $(this).data('pheight')}, {duration: 600, easing: "easeOutExpo"} );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very simple list of objects that represt people. Each object has
I have simple remoting API that has method similar to this: bool FillMyList(List<string> ListToFill)
I currently have a simple list view adapter that holds two rows of text.
Ok we have a simple udf that takes a XML integer list and returns
I have a simple list of strings that I populate into an Adapter per
I have a simple lookup list that I will use to populate a dropdown
Let's say I have a simple list: <ul> <li class=notClicked>1</li> <li class=notClicked>2</li> <li class=notClicked>3</li>
I have created the simple list view with base adapter.Now I want to add
I have a simple HTML list: <ul> <li> <div class=slideshow1> <img class=bradius5 slide1 src=<?php
I have a simple unordered list with 16 list items. I want to add

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.