$(".main-slideshow article").each(function() {
$('<img src="'+$(this).css("background-image")+'">').prependTo($(this));
});
http://we stm ark.fin alsit e.com/
Trying to grab the slick sliders <article>
background image and append an image with the said background image. Nothing is being appended though. Can anyone take a look and spot why?
FIgured out the issue - the slick slider hadn’t rendered yet when I put that code in.
I needed to wait until it was loaded, and then call the Javascript.
How do I strip out the url() portion of the background image though? Right now this is the sort of IMG prepended.
<img src="url(asdf.jpg)">
Got it -
$(".main-slideshow article").each(function() {
$('<img src="'+$(this).css("background-image").replace(/^url|[\(\)]/g, '')+'">').prependTo($(this));
});
</thread>
2 Likes
system
Closed
October 28, 2015, 8:54pm
4
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.