I am trying to manipulate one particular element which contains a piece of text, I want to wrap it in an href, although I am using css background red to prove targeting of the element.
I am using Galleria 1.2.8 and I currently have a function which fires on ajaxComplete and works.
This is the current working function:
// dynamically create data-links for all gallery items
$(document).ajaxComplete(function() {
$('#galleria a').each(function() {
var $href = $(this).attr('href');
$(this).children().attr('data-link',$href);
});
$('.galleria-info-description:contains("NN")').css('background', 'red');
});
The last line is the part of that function is not working.
This is the simplified basic block of html which is created dynamically:
<div class="galleria-container">
<div class="galleria-stage">
</div>
<div class="galleria-thumbnails-container">
</div>
<div class="galleria-info">
<div class="galleria-info-text">
<div class="galleria-info-description">
NN Contemporary Art
</div>
</div>
<div class="galleria-info-link">
</div>
<div class="galleria-info-close">
</div>
</div>
</div>
I've tried quite a few variations, creating a variable to hold the content and manipulate that. Targeting the class by drilling down through several of its parents, nothing seems to work. I can, on ajaxComplete, remove the #galleria id from the page completely, just cannot seem to get the specific element returned in an object.
TIA.
So it's a bit clunky, but I checked the galleria documentation here: http://galleria.io/docs/api/methods/#retrieval
I have now added this code just before the galleria init:
Galleria.ready(function(options) {
$targetElem = ( this.getData([10]));
$targetElem.description = '<a href="http://www.nncontemporaryart.org/exhibitions/guests- hosts" target="_blank">NN Contemporary Art Northampton</a>';
});