PageSourceSearch

https://streamsoft.app/js/element-in-view.js

js streamsoft.app collected 2026-10-02 01:15:17 UTC 1,887 bytes, 53 lines download raw bytes

1(function($) {
2
3  /**
4   * Copyright 2012, Digital Fusion
5   * Licensed under the MIT license.
6   * http://teamdf.com/jquery-plugins/license/
7   *
8   * @author Sam Sehnert
9   * @desc A small plugin that checks whether elements are within
10   *     the user visible viewport of a web browser.
11   *     only accounts for vertical position, not horizontal.
12   */
13
14  $.fn.visible = function(partial) {
15    
16      var $t            = $(this),
17          $w            = $(window),
18          viewTop       = $w.scrollTop(),
19          viewBottom    = viewTop + $w.height(),
20          _top          = $t.offset().top,
21          _bottom       = _top + $t.height(),
22          compareTop    = partial === true ? _bottom : _top,
23          compareBottom = partial === true ? _top : _bottom;
24    
25    return ((compareBottom <= viewBottom) && (compareTop >= viewTop));
26
27  };
28    
29})(jQuery);
30
31$(window).on('scroll', function() {
32  
33  $(".banner-section .image-layer, .banner-section .image-column .image, .agency-section .agents-images .agent, .agency-section .agents-images .agent-1, .agency-section .agents-images .agent-2, .agency-section .agents-images .agent-3, .agency-section .agents-images .agent-4").each(function(i, el) {
34    var el = $(el);
35    if (el.visible(true)) {
36      el.addClass("now-in-view"); 
37    } else {
38      el.removeClass("now-in-view");
39    }
40  });
41  
42});
43
44$(document).on('ready', function() {
45  $(".banner-section .image-layer, .banner-section .image-column .image, .agency-section .agents-images .agent, .agency-section .agents-images .agent-1, .agency-section .agents-images .agent-2, .agency-section .agents-images .agent-3, .agency-section .agents-images .agent-4").each(function(i, el) {
46	var el = $(el);
47	if (el.visible(true)) {
48	  el.addClass("now-in-view"); 
49	} else {
50	  el.removeClass("now-in-view");
51	}
52  });
53});

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.