Separacion de js a archivos por pagina

This commit is contained in:
2020-06-17 23:16:29 -04:00
parent 429e4187fb
commit 5967a6c931
13 changed files with 363 additions and 347 deletions

View File

@ -22,38 +22,14 @@
</div>
</div>
@push('scripts')
<script type="text/javascript">
var testimonios = [
@foreach ($testimonios as $testimonio)
{
contenido: '{{$testimonio->contenido}}',
emisor: '{{$testimonio->emisor}}'
},
@endforeach
]
var current_testimonio = 0
function cambiar(id) {
if (id == current_testimonio) {
return
}
$('#testimonio').html('').append(
$('<p></p>').html(testimonios[id].contenido)
).append(
$('<div></div>').attr('class', 'ui header').html(testimonios[id].emisor)
)
$('#marcador').find(".icon[data-id='" + current_testimonio + "']").addClass('outline')
$('#marcador').find(".icon[data-id='" + id + "']").removeClass('outline')
$('#marcador').find('.icon.outline').css('cursor', 'pointer')
$('#marcador').find('.icon:not(.outline)').css('cursor', 'default')
current_testimonio = id
}
$(document).ready(function() {
$('#marcador').find('.icon').click(function() {
var id = $(this).attr('data-id')
cambiar(id)
})
$('#marcador').find('.icon.outline').css('cursor', 'pointer')
})
</script>
@push('readyjs')
testimonios.testimonios = [
@foreach ($testimonios as $testimonio)
{
contenido: '{{$testimonio->contenido}}',
emisor: '{{$testimonio->emisor}}'
},
@endforeach
]
testimonios.setup()
@endpush