fixes item_url. sets image height

This commit is contained in:
buttle 2021-07-10 22:19:48 +02:00
parent 56cd480231
commit 8f612dac0d
1 changed files with 10 additions and 11 deletions

View File

@ -8,7 +8,7 @@ $this->headLink()->appendStylesheet($this->assetUrl('css/gallery.css', 'ImageGal
<div class="archive-gallery"> <div class="archive-gallery">
<div class="source-link"> <div class="source-link">
<a href="<?= $item_url ?>">Source</a> <a href="">Source</a>
</div> </div>
<section id="<?= $gallery_id ?>" <section id="<?= $gallery_id ?>"
@ -27,11 +27,12 @@ $this->headLink()->appendStylesheet($this->assetUrl('css/gallery.css', 'ImageGal
<img class="gallery__img" <img class="gallery__img"
style="" style=""
src="<?= $image['media_url'] ?>" src="<?= $image['media_url'] ?>"
alt="<?= $image['media_url'] ?>" item_url="<?= $image['item_url'] ?>"
alt=""
/> />
<label for="<?= $img_id ?>" class="gallery__thumb"> <label for="<?= $img_id ?>" class="gallery__thumb">
<img src="<?= $image['media_url'] ?>" <img src="<?= $image['media_url'] ?>"
alt="<?= $image['media_url'] ?>" alt=""
item_url="<?= $image['item_url'] ?>" item_url="<?= $image['item_url'] ?>"
onclick="updateSourceURL(this)" onclick="updateSourceURL(this)"
/> />
@ -58,14 +59,10 @@ function updateSourceURL(thumbnail){
.find('.source-link') .find('.source-link')
.find('a').prop('href', $(thumbnail).attr('item_url')); .find('a').prop('href', $(thumbnail).attr('item_url'));
} }
jQuery(document).ready(function() { jQuery(document).ready(function() {
$('.archive-gallery').each(function(i, el){ $('.archive-gallery').each(function(i, el){
var first_thumbnamil = $(el).find('.gallery__thumb:first') var first_thumbnail = $(el).find('.gallery__img:first')
.find('img'); updateSourceURL(first_thumbnail)
updateSourceURL(first_thumbnamil)
}); });
}); });
@ -76,8 +73,10 @@ jQuery(document).ready(function() {
gallery_image_height = $(this).height(); gallery_image_height = $(this).height();
} }
}); });
$( ".gallery__img" ).each(function( index ) {
$(this).css('height', gallery_image_height)
});
$('section.gallery').css('padding-top', gallery_image_height) $('section.gallery').css('padding-top', gallery_image_height)
//$(".gallery__thumb:first-of-type").css('margin-left', 0)
//$(".gallery__thumb:last-of-type").css('margin-right', 0)
}); });
</script> </script>