css - How to animate or timing a Pseudo class using jQuery -


say have element , want change on hover state.

using pseudo class this:

#element:before { background-position: 0px -50px; } #element:hover:before { background-position: -50px -50px; } 

can implement jquery animation function it? or can time transition?

this not possible jquery.

content created :after or :before not part of dom , therefore cannot selected or modified.
- (source)

you use in css achive transition effect, not work in older browsers:

#element:before {     -webkit-transition: background-position 1s linear;     -moz-transition: background-position 1s linear;     -o-transition: background-position 1s linear;     -ms-transition: background-position 1s linear;     transition: background-position 1s linear; } 

Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -