@if ($imagenes !== false)
@foreach (array_values($imagenes) as $i => $imagen)
{!!$imagen->thumb->html!!}
@endforeach
@else
No hay imagenes.
@endif
@endsection
@push('styles')
@endpush
@push('readyjs')
let media = [
@foreach ($imagenes as $media)
'{!!$media->media->html!!}',
@endforeach
]
let thumbs = $('#thumbs .image img')
thumbs.each((i, el) => {
let src = $(el).attr('src')
if (src == '#') {
return
}
let w = el.width
let h = el.height
let parent = $(el).parent()
let r = w / h
if (r > 1) {
$(el).height(parent.height())
$(el).width(parent.height() * r)
} else {
$(el).width(parent.width())
$(el).height(parent.width() / r)
}
})
$('.imagen').css('cursor', 'pointer').click(function() {
var id = $(this).attr('data-id')
var src = media[id]
$('#seleccionada').html(src)
if (src.indexOf('