jquery - How to make image bounce up over logo text while mouse hovers? -
i trying create this, logo image pop on logo text when mouse hovers on it. can make text fade, cannot seem make logo bounce in header portion.
#logo-bunny { background: url(../images/logo-bunny.png); position: absolute; top: 84px; } .ri-logo { display: block; position: relative; margin: 0 auto; top: 0; overflow: hidden; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .ri-logo:hover { transition: 0.25s; -o-transition: 0.25s; -ms-transition: 0.25s; -moz-transition: 0.25s; -webkit-transition: 0.25s; opacity: 0; } .ri-logo:hover ~ #logo-bunny { top: -20px; }
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"> <a class="navbar-brand ri-logo" href="/">resonance inn <div id="logo-bunny"> </div> </a>
try utilizing css
animation
#logo-bunny { background: url(http://lorempixel.com/50/50/animals); width: 50px; height: 50px; position: absolute; top: 50px; opacity:0; } .ri-logo { height:100px; display: block; position: relative; margin: 0 auto; top: 50px; /*overflow: hidden;*/ -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .ri-logo:hover { transition: 0.25s; -o-transition: 0.25s; -ms-transition: 0.25s; -moz-transition: 0.25s; -webkit-transition: 0.25s; color:transparent; } .ri-logo:hover > #logo-bunny { animation: popup 1500ms ease-in-out 0s both; -moz-animation: popup 1500ms ease-in-out 0s both; -ms-animation: popup 1500ms ease-in-out 0s both; -o-animation: popup 1500ms ease-in-out 0s both; -webkit-animation: popup 1500ms ease-in-out 0s both; } @keyframes popup { 0% { top:50px; opacity:0; } 50% { top:-45px; } 100% { top:-10px; opacity:1; } } @-moz-keyframes popup { 0% { top:50px; opacity:0; } 50% { top:-45px; } 100% { top:-10px; opacity:1; } } @-o-keyframes popup { 0% { top:50px; opacity:0; } 50% { top:-45px; } 100% { top:-10px; opacity:1; } } @-webkit-keyframes popup { 0% { top:50px; opacity:0; } 50% { top:-45px; } 100% { top:-10px; opacity:1; } }
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"> <a class="navbar-brand ri-logo" href="/">resonance inn <div id="logo-bunny"> </div> </a>
Comments
Post a Comment