Javascript Range Slider Problem

Hello, i have a javascrip range slider, here is the link: http://neuecommunity.bplaced.net/test/slidertest.php

I want to know if it is possible to make the javascript files smaller and only but the javascript functions which are needed for this simple slider into one javascript file?

You can always put all your JS in one file if you like, but it may not always be very practical.

One thing you can do is go to the jQuery site and create your own version of it by including only the bits you need. Not sure how easy it is to determine which bits you need for this, though.

1 Like

It is a hell of a work to do code splitting professionally without any other tools. Tools like webpack help to create code bundles for various entry points. So you only load the source that is required for a page or a set of pages. Digging into automation tools like webpack can take some time. Doing this manually will take you time everytime you have to add or remove something. You would have to download a custom jquery and jquery ui js and css file for every page, depending on what features you use.

Alternatively, I can suggest using nouislider, if you look for a lighter alternative to jquery with jquery ui. (only ~8kb script and ~1.2kb css)

I recently used range sliders massively in a project, which is why I wrote an article to showcase how nouislider works and how you can implement it in your codebase.
For codesplitting: If you are unfamiliar with nodejs, webpack etc. you are not the only one freaked out by the amount of setup required to deliver productive code.

Best,
Martin

1 Like

Thank you for your tipps they where very helpfull.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.