PageSourceSearch

https://www.geyservillegunclub.com/wp-content/themes/geyservillegunclub/js/jquery.flexverticalcenter.js

js geyservillegunclub.com collected 2026-10-04 02:40:13 UTC 1,847 bytes, 57 lines download raw bytes

1/*global jQuery */
2/*!
3* FlexVerticalCenter.js 1.0
4*
5* Copyright 2011, Paul Sprangers http://paulsprangers.com
6* Released under the WTFPL license
7* http://sam.zoy.org/wtfpl/
8*
9* Date: Fri Oct 28 19:12:00 2011 +0100
10*/
11(function( $ ){
12
13  $.fn.flexVerticalCenter = function( options ) {
14    var settings = $.extend({
15      cssAttribute:   'margin-top', // the attribute to apply the calculated value to
16      verticalOffset: 0,            // the number of pixels to offset the vertical alignment by
17      parentSelector: null,         // a selector representing the parent to vertically center this element within
18      debounceTimeout: 25           // a default debounce timeout in milliseconds
19    }, options || {});
20
21    return this.each(function(){
22      var $this   = $(this); // store the object
23      var debounce;
24
25      // recalculate the distance to the top of the element to keep it centered
26      var resizer = function () {
27
28        var parentHeight = (settings.parentSelector && $this.parents(settings.parentSelector).length) ?
29          $this.parents(settings.parentSelector).first().height() : $this.parent().height();
30
31        $this.css(
32          settings.cssAttribute, ( ( ( parentHeight - $this.height() ) / 2 ) + parseInt(settings.verticalOffset) )
33        );
34      };
35
36      // Call on resize. Opera debounces their resize by default.
37      $(window).resize(function () {
38          clearTimeout(debounce);
39          debounce = setTimeout(resizer, settings.debounceTimeout);
40      });
41
42      // Call once to set after window loads.
43      $(window).load(function () {
44          resizer();
45      });
46
47      // Apply a load event to images within the element so it fires again after an image is loaded
48      $this.find('img').load(resizer);
49
50    });
51
52  };
53
54})( jQuery );
55
56
57

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.