Plugin doesn't recognise inserted HREFs
-
Hello there!
Firstly beautiful plugin – thank you!
Though I have an issue that if I insert the URL into an HREF tag via Javascript when the document is ready, the plugin doesn’t recognise the image and so ignores the link. You can see this here, under the Gallery section: https://pitfarmtennis.co.uk/home-test/.
The first 68 images work fine, as their links are already there, but if you click view more images, those images have had their links inserted via javascript, as shown below, and so the plugin doesn’t seem to recognise them. Is there any way aroudn this please?Very many thanks
<script type=”text/javascript”>
jQuery(document).ready(function($) {
<?php $imagesids2 = array_slice($imagesids, 8); ?>
var images = [ <?php foreach( $imagesids as $imageid2 ): echo “‘” . wp_get_attachment_image_src( $imageid2, $size=’large’ )[0] . “‘, “; endforeach; ?> ];
$(“.viewfullalbum<?php echo $albumcount; ?>”).click(function() {
$(‘.gallery-album-contents-<?php echo $albumcount; ?> .gallery-photo’).each(function(i, obj) {
$(obj).css(“background-image”, “url(“+images[i]+”)”);
$(obj).parents().eq(1).attr(“href”, images[i]);
});$(“.gallery-album-contents-<?php echo $albumcount; ?> .gallery-photo-container-parent”).css(“display”, “inline”);
$(“.viewfullalbum<?php echo $albumcount; ?>”).css(“display”, “none”);
});
});
</script>
<?php $imagesids2 = array_slice($imagesids, 8); ?>
<?php foreach( $imagesids2 as $imageid2 ): ?>
<div class=”gallery-photo-container-parent” style=”display: none;”>
“> <!– Javascript inserts href=”…” here –>
<div class=”gallery-photo-container”>
<div class=”gallery-photo”></div><!– Javascript inserts style=”background-image: url(”)” here –>
</div>
</div>
<?php endforeach; ?>
- The topic ‘Plugin doesn't recognise inserted HREFs’ is closed to new replies.