/    Sign up×
Community /Pin to ProfileBookmark

How do I resize a div on mousover…

…on a page that displays content that scales to browser size, using Javascript?

For example, if the following is my XHTML Strict:

[code=html]
<div class=”box”>
<div class=”display”>
<img src=”picture.png”>
</div>
</div>
[/code]

And, the following is my CSS:

[CODE].box {
position: relative;
width: 96%;
margin: 0;
padding: 0 2%;
}
.box .display {
width: 50%;
height: 38%;
margin: 0;
padding: 0;
overflow: hidden;
}
.box .display img {
width: 100%;
height: auto;
}[/CODE]

And, the image is 750×1000.

My code allows only the top half of the image to show, initially, which is how I want it. But, how do I have the rest of the image show on mouseover, with the basic animation of the div expanding to reveal the rest of the image? I’m using jQuery for a few other things on the site, so I’d like to stay with that library if possible.

Thanks for your help.

  • m ?
  • to post a comment
    JavaScript

    0Be the first to comment 😎

    ×

    Success!

    Help @metropolitica spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.19,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...