Jul 12, 2014 in Animation 4958 views
TwentyTwenty - jQuery Plugin to Compare Images
Source: zurb.com
1. INCLUDE JS AND CSS FILES
<script src="js/jquery-2.1.0.min.js" type="text/javascript"></script> <script src="js/jquery.event.move.js" type="text/javascript"></script> <script src="js/jquery.twentytwenty.js" type="text/javascript"></script> <link rel="stylesheet" href="css/twentytwenty.css" type="text/css" media="screen" />
2. HTML
<div id="container1"> <!-- The before image is first --> <img src="http://placehold.it/400x200&text=1" /> <!-- The after image is last --> <img src="http://placehold.it/400x200&text=2" /> </div>
3. JAVASCRIPT
$(window).load(function(){ $("#container1").twentytwenty(); });
4. OPTIONS
$(window).load(function(){ $(".twentytwenty-container").twentytwenty({ default_offset_pct: 0.7, // How much of the before image is visible when the page loads orientation: 'vertical' // Orientation of the before and after images ('horizontal' or 'vertical') }); });
Tagged with:
twentytwenty
compare images
differences between two images
visual diff tool
visual differences
highlight the differences
swipe between two images
responsive
Related Articles