{"_id":"juxtaposejs","_rev":"3-3a5c2b1eff58b6e2a7cef1645ae98872","name":"juxtaposejs","description":" JuxtaposeJS is a JavaScript library for making before/after image sliders","dist-tags":{"latest":"1.1.6"},"versions":{"1.1.6":{"name":"juxtaposejs","version":"1.1.6","description":" JuxtaposeJS is a JavaScript library for making before/after image sliders","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/NUKnightLab/juxtapose.git"},"files":["build/css/juxtapose.css","build/js/juxtapose.js","build/js/juxtapose.min.js","README.md"],"keywords":["image","ui","slider","juxtapose","before","after"],"author":{"name":"knightlab@northwestern.edu"},"license":"MPL-2.0","bugs":{"url":"https://github.com/NUKnightLab/juxtapose/issues"},"homepage":"http://juxtapose.knightlab.com","contributors":[{"name":"The following people have contributed code to JuxtaposeJS:"},{"name":"* Alex Duner","url":"@asduner"},{"name":"* Joe Germuska","url":"@JoeGermuska"},{"name":"* KK Rebecca Lai","url":"@kkrebeccalai"},{"name":"* Mallory Busch","url":"@yeamal"},{"name":"* Alison Benjamin","url":"@radiocontrolled"},{"name":"* Michael Bauer","url":"@mihi_tr"}],"gitHead":"b4d3ca3529417ced9d16f146d3c63b957e894c76","_id":"juxtaposejs@1.1.6","_shasum":"7173ea7416102e93950c6997895b8a075864ce73","_from":".","_npmVersion":"1.4.23","_npmUser":{"name":"duner","email":"asduner@gmail.com"},"maintainers":[{"name":"duner","email":"asduner@gmail.com"}],"dist":{"shasum":"7173ea7416102e93950c6997895b8a075864ce73","tarball":"https://registry.npmjs.org/juxtaposejs/-/juxtaposejs-1.1.6.tgz","integrity":"sha512-bweRAIwSTx7q50Z3KAt7Dm8jwzcJP227gVm3AkDgglWCrUqOB3yl+6srYILbh40BVsno/EtK+mdGJGJn+wPJ3g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCxDWd9nLWQ5Es3X0+uHbek7CkUJ2siZQMlIVFuPY6zpAIhAJB5MpuS18F1BX7Cgao4NL0W33/yNJFlEiI6mKqMZlWd"}]}}},"readme":"#JuxtaposeJS\n\n[JuxtaposeJS](https://juxtapose.knightlab.com) is a simple, open source tool for creating before/after image sliders. Just provide two image URLs and Juxtapose will do the rest of the work for you. Below are instructions for implementing Juxtapose with HTML and Javascript but we also have a [tool that lets you make a slider without needing to know any code](https://juxtapose.knightlab.com#create-new).\n\nIf you want to contribute to Juxtapose, check out the `DEVELOPERS.md` file for installation instructions. Fork the project, create a new branch with your features, and submit a pull request. Thanks for your help!\n\n###Instructions\n\n####HTML Implementation\nThe easiest way to implement the image slider is to add this code to your markup:\n\n    <div class=\"juxtapose\">\n        <img src=\"http://example.com/firstimage.jpg\" />\n        <img src=\"http://example.com/secondimage.jpg\" />\n    </div>\n    <script src=\"http://cdn.knightlab.com/libs/juxtapose/latest/js/juxtapose.min.js\"></script>\n\nEach image can also take some additional attributes.\n\n    <img src=\"http://image.jpg\" data-label=\"2009\" data-credit=\"Alex Duner/Northwestern Knight Lab\" />\n\nIf each image has an `data-label` attribute defined, the slider will display a label on each image. If each image has a `data-credit` attribute defined, the slider will display a credit for each image.\n\nThe main wrapper can also take some additional attributes as well to specify a few options:\n\n    <div id=\"juxtapose-wrapper\" class=\"juxtapose\" data-startingposition=\"35%\" data-showlabels=\"false\" data-showcredits=\"false\" data-animate=\"false\">\n\nSpecifying a starting position with `data-startingposition` lets you focus the users attention on the part of the image where the change is most noticeable. To toggle the visibility of the labels and the credits respectively, set `data-showlabels` and `data-showcredits` to false. And to disable the animation, set `data-animate` to false.\n\nIf you are using Juxtapose in an existing responsive iFrame solution like [pym.js](http://blog.apps.npr.org/pym.js/) and don't want to use Juxtapose's built in (but faily opinionated) responsive iFrame solution, you can set `data-makeresponsive` to false.\n\n####Javascript Implementation\nThe `JXSlider` class takes three arguments. First, is the string of the ID of the element you want to turn into a slider. Second is an array of two objects. Each object *must* have `src` defined and can optionally define a `label` and a `credit`. The third argument lets you set additional options for the image slider.\n\n    <div id=\"foo\"></div>\n    <script>\n    slider = new juxtapose.JXSlider('#foo',\n        [\n            {\n                src: 'http://firstimage.jpg',\n                label: '2009',\n                credit: 'Image Credit'\n            },\n            {\n                src: 'http://secondimage.jpg',\n                label: '2014',\n                credit: \"Image Credit\"\n            }\n        ],\n        {\n            animate: true,\n            showLabels: true,\n            showCredits: true,\n            startingPosition: \"50%\"\n        });\n    </script>\n\n###Modifications\n####CSS\nYou can customize how JuxtaposeJS looks by modifying its CSS. For instructions, [click here](https://github.com/NUKnightLab/juxtapose/wiki/Styling-the-Slider).\n\n####JavaScript\n\nThe JXSlider class contains a few methods you can use to modify your sliders.\n\nIf you instantiated your sliders with the HTML method but still want to access one of your sliders programmatically, JuxtaposeJS creates an array of the JXSliders on your page that you can access with `juxtapose.sliders`.\n\nJXSlider.**updateSlider**(*percentage*, *animate*)\n\n*Percentage* indicates where you want to set the handle relative to the left side of the slider. If you set *animate* to `true`, the handle will animate to the new location; if animate is set to `false`, the handle will not.\n","maintainers":[{"name":"duner","email":"asduner@gmail.com"}],"time":{"modified":"2022-06-19T07:31:13.370Z","created":"2015-10-19T16:21:48.321Z","1.1.6":"2015-10-19T16:21:48.321Z"},"homepage":"http://juxtapose.knightlab.com","keywords":["image","ui","slider","juxtapose","before","after"],"repository":{"type":"git","url":"https://github.com/NUKnightLab/juxtapose.git"},"contributors":[{"name":"The following people have contributed code to JuxtaposeJS:"},{"name":"* Alex Duner","url":"@asduner"},{"name":"* Joe Germuska","url":"@JoeGermuska"},{"name":"* KK Rebecca Lai","url":"@kkrebeccalai"},{"name":"* Mallory Busch","url":"@yeamal"},{"name":"* Alison Benjamin","url":"@radiocontrolled"},{"name":"* Michael Bauer","url":"@mihi_tr"}],"author":{"name":"knightlab@northwestern.edu"},"bugs":{"url":"https://github.com/NUKnightLab/juxtapose/issues"},"license":"MPL-2.0","readmeFilename":"README.md"}