1(function($){ 2 $(document).ready(function() { 3 var slider_container = $('.before-after-image-comparison-slider-container'); 4 5 slider_container.each(function() { 6 var slider = $(this).find('.before-after-image-comparison-slider'); 7 var before = $(this).find('.comparison-slider-before-image'); 8 var beforeImage = before.find('.comparison-slider-before-img'); 9 var resizer = $(this).find('.image-comparison-slider-resizer'); 10 11 var active = false; 12 13 // Set full width initially 14 var setBeforeImageWidth = function() { 15 var width = slider.outerWidth(); 16 beforeImage.css('width', width + 'px'); 17 }; 18 19 setBeforeImageWidth(); 20 $(window).on('resize', setBeforeImageWidth); 21 22 resizer.on('mousedown touchstart', function(e) { 23 active = true; 24 resizer.addClass('resize'); 25 pauseEvent(e); 26 }); 27 28 $('body').on('mouseup touchend touchcancel', function() { 29 active = false; 30 resizer.removeClass('resize'); 31 }); 32 33 $('body').on('mousemove touchmove', function(e) { 34 if (!active) return; 35 36 var x; 37 if (e.type === 'touchmove') { 38 x = e.originalEvent.touches[0].pageX; 39 } else { 40 x = e.pageX; 41 } 42 43 x -= slider.offset().left; 44 slideIt(x); 45 pauseEvent(e); 46 }); 47 48 function slideIt(x) { 49 var width = slider.outerWidth(); 50 var transform = Math.max(0, Math.min(x, width)); 51 before.css('width', transform + 'px'); 52 53 var resizerLeft = (transform === 0) ? (transform - 7) : (transform - 2); 54 resizer.css('left', resizerLeft + 'px'); 55 } 56 57 function pauseEvent(e) { 58 if (e.stopPropagation) e.stopPropagation(); 59 if (e.preventDefault) e.preventDefault(); 60 e.cancelBubble = true; 61 e.returnValue = false; 62 return false; 63 } 64 }); 65 }); 66})(jQuery); 67
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.