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

257
Vistas
How to convert Swiper.js into ES5

I use babel to convert it but the swiper is not working and it shows this error in console.

enter image description here

I go to the line where this error happen and add console.log().

      if (params.el && $(params.el).length > 1) {
        var swipers = [];
        console.log($(params.el))
        $(params.el).each(function (containerEl) {
          var newParams = extend({}, params, {
            el: containerEl
          });
          swipers.push(new Swiper(newParams));
        });
        return swipers;
      } // Swiper Instance

There's no problem getting these elements but somehow $(...).each just doesn't work.

enter image description here

What can i do to fix this?

Or is there something wrong when converting?

My .babel is simple, as below

{
  "presets": ["es2015"]
}

I use gulp-babel to convert it. In package.json:

  "dependencies": {
    "babel-cli": "^6.26.0",
    "babel-core": "^6.26.3",
    "babel-preset-env": "^1.7.0",
    "gulp": "^4.0.2",
    "gulp-babel": "^7.0.1",
    "url-search-params-polyfill": "^8.1.1"
  },
  "devDependencies": {
    "babel-preset-es2015": "^6.24.1"
  },

And in gulpfile.js:

function to_es5() {
  gulp
    .src("./src/js/*.js")
    .pipe(
      babel({
        presets: ["es2015"],      })
    )
    .pipe(gulp.dest("./src/js-es5/"))
 }

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