I have slightly refined my question from the generic "detect image" question I posted earlier.
I want to detect the background image and once that has been done, remove a class from a totally different element within the DOM.
HTML:
<div class="rh-big-hero-wrapper" style="background-image:url('bg-sample-10.jpg');">
JS:
$(function() {
'use strict';
var heroElem = $('.rh-big-hero-wrapper');
var imgElem = ('bg-sample-10.jpg');
var visClass = $('rh-notvisible');
// hides article product relation in hero.
$('.rh-big-hero-heading-product-item-inner').addClass('rh-notvisible'); {
//console.log('class has been added...just checking, cause Im loosing my mind');
};
heroElem.css('background-image');
// console.log(heroElem);
heroElem.find(imgElem); {
// console.log('displaying', imgElem);
if($(this).is(':visible')) {
console.log(imgElem, 'is visible');
$('.rh-big-hero-heading-product-item-inner').removeClass(visClass);
};
} });
Thank you for your advice, solutions and guidance in advanced.