简体   繁体   中英

Toggle Class toggling, but not animating

This is directed towards a psuedo element :after :

 &:after {
    content:" ";
    display:block;
    position:absolute;
    top:358px;
    left:263px;
    width:0;
    height:0;
    border-style:solid;
    border-color:#f8f8f8 transparent;
    border-width: 0 23px 23px 23px;    
 }
 &.moved:after {
  left: 656px;
 }

And then what I do is .toggleClass to make it move :

$('#big-icon-nav').toggleClass( 'moved', 1000 )

And it moves, but it does not animate. Is this even possible? Why is it not?

As far as I know jQuery can't really handle :after and :before pseudo-elements. Do you really have to use an after element or would it be possible to do the same with a "normal" html tag?

If not you may want to take a look at this answer

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM