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

250
Views
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
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!