PageSourceSearch

https://www.helmswealth.com/js/video-scroll-play.js

js helmswealth.com collected 2026-09-28 09:00:56 UTC 1,154 bytes, 40 lines download raw bytes

1$(document).ready(function() {
2    // Get media - with autoplay disabled (audio or video)
3    var media = $('.js-video-autoplay').not("[autoplay='autoplay']");
4    var tolerancePixel = 200;
5
6    function checkMedia() {
7
8        // Get current browser top and bottom
9        var scrollTop = $(window).scrollTop() + tolerancePixel;
10        var scrollBottom = $(window).scrollTop() + $(window).height() - tolerancePixel;
11
12        //if ($(window).scrollTop() > $(window).height() - 10) {
13        media.each(function(index, el) {
14
15        	//see if video ended
16        	$(this).on('ended', function() {
17            	//console.log('Video has ended!');
18            	$(this).addClass('ended');
19        	});
20
21
22
23            var yTopMedia = $(this).offset().top;
24            var yBottomMedia = $(this).height() + yTopMedia;
25
26            if (scrollTop < yBottomMedia && scrollBottom > yTopMedia) {
27
28            	if (!$(this).hasClass('ended')) {
29            		$(this).get(0).play();
30            	}
31                
32            } else {
33                $(this).get(0).pause();
34            }
35        });
36
37        //}
38    }
39    $(document).on('scroll', checkMedia);
40});

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.