Some useful code for plugin Section Loader Supreme.
#1. Make Carousel image clickable + hide button
Add to Footer Injection, change section ID in the code
<script>
(function() {
var CONFIG = {
sections: [
'section[data-section-id="69953a1d06742a256cbcc026"]'
]
};
function injectCSS() {
var selectors = CONFIG.sections.map(function(sel) {
return sel + ' .list-item-content__button-container';
}).join(', ');
var style = document.createElement('style');
style.textContent = selectors + ' { display: none; }';
document.head.appendChild(style);
}
function wrapImageWithLink() {
CONFIG.sections.forEach(function(sel) {
var listItems = document.querySelectorAll(sel + ' .list-item');
listItems.forEach(function(item) {
var img = item.querySelector('.slide-media-container img');
var link = item.querySelector('.list-item-content__button-container a');
if (!img || !link) return;
if (img.closest('a.wm-img-link')) return;
var newLink = document.createElement('a');
newLink.href = link.href;
newLink.className = 'wm-img-link';
img.parentNode.insertBefore(newLink, img);
newLink.appendChild(img);
});
});
}
function init() {
injectCSS();
wrapImageWithLink();
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}
document.addEventListener('wmSectionLoader:ready', wrapImageWithLink);
document.addEventListener('wmSectionLoader:afterInit', wrapImageWithLink);
})();
</script>