bendc / animateplus

A+ animation module for the modern web

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Selecting pseudo elements (before/after)

uzumakinaruto123 opened this issue · comments

Can pseudo elements be selected ? I am planning to animate bacground image.I have something like this

.container:before {
    background-image: url("xyz.png");
}

How can i select .container:before ?

Thanks !

@uzumakinaruto123 try https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle

var container      = document.querySelector('.container'), 
var result         = getComputedStyle(container, ':before');

// To access background image use result.backgroundImage or result.getPropertyValue('backgroundImage')

// not sure if animate.js looks for backgroundImage that way or looks on style property...

But, not sure if animate.js supports that...
Try to hack the library....

Thanks alot @samosale will try that. But , Mobile browser support is still unknown as per that link. That would be the deal breaker if it doesn't. I will try first :) Thanks again