Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

171
Vistas
Having trouble getting coverflow.js JQuery module to work in Next.JS

I am trying to use the JQuery library coverflow.js to work in Next.JS. Using the solution to 61029733 as a starting point (fresh clone of the repo), I added coverflow.min.js to the public folder and added a single line to JqueryDiamonds.js as shown below:

useEffect(() => {
    window.jQuery = require('../public/jquery-latest.min');
    window.Diamonds = require('../public/jquery.diamonds.js');
    window.Coverflow = require("../public/coverflow.min.js");

    window.jQuery("#demo").diamonds({
        size : 100, // Size of diamonds in pixels. Both width and height.
        gap : 5, // Pixels between each square.
        hideIncompleteRow : false, // Hide last row if there are not enough items to fill it completely.
        autoRedraw : true, // Auto redraw diamonds when it detects resizing.
        itemSelector : `.${styles.item}` // the css selector to use to select diamonds-items.
    });
}, []);

I get the following runtime error:

TypeError: Cannot read properties of undefined (reading 'createElement')

The same happens if I use the un-minified version of Coverflow coverflow.js:

Uncaught TypeError: Cannot read properties of undefined (reading 'createElement')
at coverflow.js:2469:1

The code at this line is:

var el = document.createElement( "div" ),

I am very confused why createElement, a vanilla JavaScript function, is giving an error. Maybe it has something to do with document not being defined, however this shouldn't be happening since the way the component is being dynamically loaded disables SSR.

I know this is an old JQuery library, but I have been able to make it work by including the script in normal HTML instead of Next. There is a React package alternative to this JQuery library but that is not the solution I am looking for as it is inferior in many ways design wise.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda