css3 - animate inline element scroll full width -
for following paragraph, want animate scroll span element upon mouse hover. scroll right until end.
<div class="one_line"> <span> nomagic framework doesn't try put blackbox. hope read core source code , try understanding before start using it. , hope forking our project , creating own database helper function sets based on need. using nomagic, turn mysql database schemaless solution, schemaless database save time don't need spend time in planning database table structure. </span> </div> the css have
.one_line { line-height: 1.5em; height: 1.5em; position: relative; width: 600px; overflow-x: hidden; span { white-space: nowrap; height: 100%; display: inline-block; position: absolute; &:hover { animation-name: scroll; animation-duration: 6s; } } } @keyframes scroll { 50% { left: 100%; } }
up knowledge using css animate can animate entire tag not content in (i.e.) in case can move entire span across page dimension not text inside it. made using transform property more flexible.
i have jsfiddle here demonstrate this.
css animate code had changed:
@keyframes scroll { 0% { transform:translatex(0); } 100% { transform:translatex(-100%); } } hope useful.
Comments
Post a Comment