Touch-enabled before/after slider. Inspired by before-after.js.
Install with NPM
npm install cocoen --save
Install with Bower
bower install cocoen --save
Or download the latest release.
Only the class cocoen
is mandatory to apply proper default styles:
<div class="cocoen">
<img src="img/before.jpg" alt="">
<img src="img/after.jpg" alt="">
</div>
Include the Cocoen stylesheet in your page:
<link rel="stylesheet" href="css/cocoen.min.css" />
Include the cocoen.min.js
script in your page, and then:
new Cocoen(document.querySelector('.cocoen'));
Multiple Cocoens in one page:
document.querySelectorAll('.cocoen').forEach(function(element){
new Cocoen(element);
});
Include the cocoen.min.js
and cocoen-jquery.min.js
scripts in your page, and then:
$('.cocoen').cocoen();
Coming soon!
The code and the documentation are released under the MIT License.