/    Sign up×
Community /Pin to ProfileBookmark

Sliding Content

Sliding Content

Hi all

I thought this would be easy but I’m stuck and I can’t describe what’s really simple so I’ve drawn a diagram to help.

[url]http://www.ttmt.org.uk/forum/10_slide/one.gif[/url]

I have a div containing an image like 1 in the diagram

I only want to show the top of the image like 2 in the diagram

When I hover over the div I want the image to scroll up to show the bottom of the image like 3 in the diagram

It seems really simple but I’m completely stuck, any help would be really appreciated.

[url]http://www.ttmt.org.uk/forum/10_slide/[/url]

[code]
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>

<html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en” lang=”en”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″/>

<title>untitled</title>
<style type=”text/css” media=”screen”>
*{
margin:0;
padding:0;
}
#wrap{
margin:50px;
width:700px;
}
ul{
list-style:none;
}

</style>
</head>

<body>
<div id=”wrap”>
<ul>
<li><a href=”#” id=”one”><img src=”img.gif” width=”250″ height=”200″/></a></li>

</ul>
</div>

<script src=”http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js”type=”text/javascript”></script>
<script>

$(‘li’).hover(function(){
$(this).find(‘img’).animate({top: + (-200) + ‘px’},200);
})
return false;

</script>

</body>
</html>
[/code]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@DanInMAApr 07.2011 — so you want just the red to show and when they hover over the link it changes from the red tot he green by scolling the image upward?

have you thought about applying this image as a background to the element "one", then using Jquery to alter the background position of the image via it's css property? -

http://www.w3schools.com/css/pr_background-position.asp
Copy linkTweet thisAlerts:
@DanInMAApr 08.2011 — I think this may be of some help, very simliar idea - http://snook.ca/archives/javascript/jquery-bg-image-animations/

as matter of fact he's got an example of what you want to do on the demo
×

Success!

Help @ttmt 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.18,
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,
)...