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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:07:27+00:00 2026-05-15T04:07:27+00:00

Ok, I have a structure like this: <div class=image> <img src=img1.jpg alt= /> </div>

  • 0

Ok, I have a structure like this:

<div class="image">
   <img src="img1.jpg" alt="" />
</div>

<div class="image">
   <img src="img1.jpg" alt="" />
</div>

<div class="image">
   <img src="img1.jpg" alt="" />
</div>

and CSS like this:

.image{
    height:100px;
    overflow: hidden;
}

SO basically, only the top 100px of the image shows. When the user hovers over the image, I want to scroll the image to the bottom 100px. i.e., it animates from showing the top 100px to the bottom 100px.

Now if all the images were the same height, it would be easy. I could do this, for a 500px high image:

$('.image img').hover(
    function(){
     $(this).stop().animate({marginTop:'-400px',}, 1000);
    },
    function(){
     $(this).stop().animate({marginTop:'0px',}, 1000);
    }
   );

Problem is, the three images are of different heights. And as far as I know, there really isn’t any reliable method to get image height cross-browser. Sp any idea how I can solve this?

Any help is much appreciated.

  • 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-15T04:07:28+00:00Added an answer on May 15, 2026 at 4:07 am

    Have you tried using jQuery’s height() method to get the height of the image? There’s likely cross-browser compatibility fixes built in.

    $('.image img').hover(
      var $th = $(this);
      var height = $th.height();
      function(){
       $th.stop().animate({marginTop:-(height - 100)}, 1000);
      },
      function(){
       $th.stop().animate({marginTop:'0px'}, 1000);
      }
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have html structure like this <div> <span class=ic> <span class=ic>12345</span> </span> </div> i
let's say I have an HTML structure like this: <div class=first> <div class=sub-1> <div
I have structure like this <div id=mali_oglasi> <p class=mali_oglas> <span class=name>Predaja7</span> <span class=body>Lorem ipsum
I am trying to use jQuery(#element-id).parent().addClass('some-class'); I have a structure something like this: <div
I have code like this: <div class='outer'> <div class='imgwrapper'><img /></div> <div class='caption'>This is a
I have a structure like this: <div class=content> <div class=board></div> </div> then, here is
I usually have my structure laid out something like this: <div id=all> <div id=page>
I have a html structure like this : <div id=nav_holder style=position:absolute;border-radius:400px;width:0px;height:0px;background-color:#460203;z-index:350px;> <div id=inner_wrap> </div>
I have a HTML structure like follows <div id=answer-1> <a class=edit></a> </div> <div id=answer-2>
I have the menu structure like below, <div class=submenu> <ul class=treeview> <li class=submenu id=menu-item-5592

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.