So i am trying to get the background-image url of each div that has the class "client" in it. From there I want put that URL into an a href and wrap around another element so i can make it pop in a light box.
I've gotten this far but it only seems to grab the first url and then applies it to all of the elements.
// Make client rotator pop-up and get image url
jQuery(document).ready(function(){
jQuery('.client').each(function(index, el) {
var bgurl = $('.bg-cover').css('background-image');
if(bgurl != 'none') {
bgurl = bgurl.replace('url("','').replace('")','');
jQuery('.client .flex_cell_inner').wrapInner('<a href="'+ bgurl +'" rel="lightbox"></a>');
};
});
});