Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm a beginner in JS and need some help! I have a div with 270px height, and a 365px height image inside it. What I need is the image to loop up and down, so people can see it all...

This is my html:

<div class="destaquetodo">
    <div class="destaqueconteudo">
        <div class="destaquecapa">
             <img src="/imagens/2013/se-beber-nao-case-3/grande"></div>
        </div>
    <div class="destaquebox"></div>
</div>
share|improve this question
1  
api.jquery.com/animate –  caramba Jun 19 '13 at 17:13
add comment

1 Answer

up vote 0 down vote accepted

Yay!

You dont need any JS to do this, with a little bit of CSS3 Animation and Transition you can achieve a great effect, look at this fiddle: http://jsfiddle.net/k9nvB/1/

@keyframes up-down-loop {
    0% {
        top: 0;
    }
    50% {
        top: -95px;
    }
    100% {
        top: 0;
    }
}

With this @keyframe you have a great effect, just adapt it to your project :)

share|improve this answer
    
thanks, it worked pretty good, ill use it... but theres any way to keep the position it is when you move the mouse out of it? thanks again! –  diogo Jun 19 '13 at 21:21
    
without js i dont think so –  Oswaldo Acauan Jun 21 '13 at 15:08
    
edit: actually you can do it with only CSS YAAYY!!! Look at this: jsfiddle.net/k9nvB/1 –  Oswaldo Acauan Jun 21 '13 at 15:12
    
incredible! thanks to both of you!! –  diogo Jun 26 '13 at 1:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.