« Back to the HTML Forum

how do i make my image jump

Posted by sans

posted

Forum: HTML Group

ok so i have the code i NEED to use


<div style="max-height: 300px; position: fixed; right: -10px; bottom: 17px; z-index: 99;">
<img src="(pretend this is the image okay)" height="250"/></div><style>


but i also want it to jump which i have but i dont want the hover part and make it so only my image jumps


<style>

@keyframes bounce {

  5% { transform: translateY(0); }

  100% { transform: translateY(-17px); }

}

img:hover{animation: bounce 0.17s infinite alternate !important;}

</style>




please help me..


Report Topic

2 Replies

Sort Replies:

Reply by ୨ৎMIMA୨ৎ

posted

<div id="bounceImg" style="max-height: 300px; position: fixed; right: -10px; bottom: 17px; z-index: 99;">
<img src="YOUR-IMAGE" height="250"/></div>

<style>

@keyframes bounce {

  0% { transform: translateY(0); }

  100% { transform: translateY(-17px); }

}

#bounceImg:hover{animation: bounce 0.17s infinite alternate !important;}

</style>

I added an id because just using img:hover will hover all of the imgs in your profile. If you meant you want it without a hover at all just remove the :hover.

<div id="bounceImg" style="max-height: 300px; position: fixed; right: -10px; bottom: 17px; z-index: 99;">
<img src="YOUR-IMAGE" height="250"/></div>

<style>

@keyframes bounce {

  0% { transform: translateY(0); }

  100% { transform: translateY(-17px); }

}

#bounceImg{animation: bounce 0.17s infinite alternate !important;}

</style>

*side note but using styles in css is a lot cleaner n nicer than in the html itself


Permalink Report Reply

Reply by sans

posted