Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

271
Views
Recibí un error al agregar mampostería a mi aplicación alpinejs

En Laravel 8 / livewire 2.5 / alpinejs 3.4.2, trato de agregar mampostería para la lista de imágenes, pero al iniciarlo por ID o por nombre de clase, recibí un error:

 Uncaught TypeError: document.getElementById(...).masonry is not a function at Proxy.onHostelsGalleyViewPageComponentInit

En el archivo blade:

 <div class="frontend_page_container" x-data="hostelsGalleyViewPageComponent()" x-init="[onHostelsGalleyViewPageComponentInit() ]" id="hostels_gallery_page_container"> <section class="relative py-10"> <div class="container mx-auto px-4"> @if(count($hostelsDataRows) > 0) <div class="main_gallery__blocks" id="main_gallery__blocks"> @foreach($hostelsDataRows as $nextHostel) @livewire('hostel.hostel-gallery-item', ['nextHostel' => $nextHostel, 'loop_index'=> $loop->index]) @endforeach </div> @endif </div> </section> <script src="https://unpkg.com/masonry-layout@4/dist/masonry.pkgd.min.js"></script> <script> function hostelsGalleyViewPageComponent() { return { onHostelsGalleyViewPageComponentInit: function () { console.log('onHostelsGalleyViewPageComponentInit::') // var $grid = document.getElementsByClassName('main_gallery__blocks').masonry({ // THIS LINE RAISE the same error var $grid = document.getElementById('main_gallery__blocks').masonry({ itemSelector: '.main_gallery__block', columnWidth: '.main_gallery__block', percentPosition: true }) }, } } // function hostelsGalleyViewPageComponent() { </script> </div>

¿Cuál es la forma correcta?

¡Gracias!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!