A
A
Alexander Timofeev2015-11-11 11:39:34
css
Alexander Timofeev, 2015-11-11 11:39:34

How to preload images via js, jquery, if they are set in pseudo-elements via content?

For preloading, I generally found this way:

function preloadImages()
{
  for(var i = 0; i<arguments.length; i++)
    $("<img />").attr("src", arguments[i]);
}

preloadImages("img/hoverimage1.jpg","img/hoverimage2.jpg");


But, as I understand it, it is directly for the image in html through the img tag.
And you need to load something like this:
a.active:before {
    content: url(images/pasatizi.png);
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Inwork277, 2015-11-11
@Inwork277

I could be wrong, but what prevents preloadImages(); and then put the url in a.active:before in content after it loads?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question