css3/Jquery animation/transition/: How to make image move vertically and back?
-
I want to do this effect in my image (button) http://osc4.template-help.com/wt_32608/index.html# I want to make this animation whatever the method CSS3, HTML5 canvas , JS If I will use Hover property , how can I make the image slide and back when roolout
-
Answer:
First, make a < div > that will contain the animation. <div id="image_holder"></div> Then, place the < img > inside. <div id="image_holder_1" class="image_holder"> <img id="image_1" class="image" ..... /> </div> Next, add some CSS styling to the < div > like so: .image_holder { overflow: hidden; } And also some CSS to the < img >: .image { position: relative; } Now, animate the image with jQuery. Specifically, you will be animating the "top" CSS attribute for the image: $('#image_holder_1').hover( function() { $('#image_1').animate({ top: '-' + $(this).height() + 'px' }); }, function() { $('#image_1').animate({ top: '0px' }); }); See it in action here: http://jsfiddle.net/trusktr/7hTDu/ Alternatively, you can do it with CSS3 animations. Do a search for "CSS3 transitions" on google: http://www.google.com/search?btnG=1&pws=0&q=CSS3+transitions
Maged at Stack Overflow Visit the source
Other answers
something like this. $(".items").each(function() { $(this).mouseover(function(){ $(this).find(".inner").slideDown(); }); $(this).mouseout(function(){ $(this).find("inner").slideUp(); }); }); but it would be better if you give us some code of your html struct, and something aboute your idea.
omnosis
The easiest way is probably to position the images absolutely and then manipulate the top, something like this: <img id="myimage" style="position: absolute" src="whatever"/> <script> $('#myimage').animate({top: '<whatever>px' },someDuration); </script> Read the jQuery animate docs here: http://www.google.dk/search?sourceid=chrome&ie=UTF-8&q=jquery+animate It should not be that hard to figure out :)
Martin Jespersen
If just an animated background to a button you want, why not use background-image and animate the background-position with jQuery?
Gareth
Related Q & A:
- How To Make An Ex Want You Back?Best solution by Yahoo! Answers
- How to make the transition to functional programming?Best solution by Programmers
- How to make background animation?Best solution by Stack Overflow
- How to make a moving animation?Best solution by goanimate.com
- How to make time move faster?Best solution by wikihow.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.