1jQuery(document).ready(function($) { 2 var widgetsConfigurations = [ 3 { 4 widget_id: '.sticky-container-firmy-category', 5 push_up_element: '.site-footer', 6 margin_top: 40, 7 bottom_fix: 34, 8 bottom_fix_last_position: -44 9 }, 10 { 11 widget_id: '.sticky-container-post-firmy-banner', 12 push_up_element: '.site-footer', 13 margin_top: 40, 14 bottom_fix: 70, 15 bottom_fix_last_position: -38 16 }, 17 { 18 widget_id: '.sticky-container-praca', 19 push_up_element: '.site-footer', 20 margin_top: 40, 21 bottom_fix: 70, 22 bottom_fix_last_position: -38 23 }, 24 { 25 widget_id: '.inside-left-sidebar', 26 push_up_element: '.site-footer', 27 margin_top: 40, 28 bottom_fix: 70, 29 bottom_fix_last_position: -38 30 }, 31 { 32 widget_id: '.sticky-container-wizytowki-firm-posts', 33 push_up_element: '.site-footer', 34 margin_top: 40, 35 bottom_fix: 34, 36 bottom_fix_last_position: -44 37 } 38 ]; 39 40 function updateWidgetWidth(widget) { 41 widget.css('width', widget.parent().width() + 'px'); 42 } 43 44 widgetsConfigurations.forEach(function(configuration) { 45 var widget = $(configuration.widget_id); 46 var pushUpElement = $(configuration.push_up_element); 47 var wpAdminBar = $('#wpadminbar'); 48 var stickyNavigation = $('#site-navigation, #sticky-navigation'); 49 50 if (widget.length && pushUpElement.length) { 51 var widgetTop = widget.offset().top; 52 var marginTop = parseInt(configuration.margin_top) || 0; 53 var bottomFix = parseInt(configuration.bottom_fix) || 0; 54 var bottomFixLastPosition = parseInt(configuration.bottom_fix_last_position) || 0; 55 56 $(window).on('scroll', function() { 57 // Sprawdź czy nie jesteÅmy na stronie przewodnika lub ludzi poniżej 969px 58 var isGuideOrPeople = $('body').hasClass('single-przewodnik') || $('body').hasClass('single-ludzie'); 59 var isMobileWidth = window.innerWidth < 969; 60 61 // JeÅli jesteÅmy na przewodniku/ludziach i mamy maÅÄ szerokoÅÄ, nie wykonuj sticky 62 if (isGuideOrPeople && isMobileWidth) { 63 widget.css({ 64 'position': 'static', 65 'width': 'auto', 66 'top': 'auto' 67 }); 68 return; 69 } 70 71 // Sprawdź czy to nie jest urzÄ dzenie mobilne (pozostaÅa logika) 72 if (window.matchMedia("(min-width: 768px)").matches) { 73 var scrollTop = $(window).scrollTop(); 74 var adminBarHeight = wpAdminBar.length && wpAdminBar.is(':visible') ? wpAdminBar.outerHeight() : 0; 75 var stickyNavigationHeight = stickyNavigation.is(':visible') ? stickyNavigation.outerHeight() : 0; 76 var pushUpElementTop = pushUpElement.offset().top; 77 78 if (scrollTop > widgetTop && scrollTop < pushUpElementTop - widget.outerHeight(true)) { 79 widget.css({ 80 'position': 'sticky', 81 'top': (adminBarHeight + marginTop + stickyNavigationHeight) + 'px', 82 'margin-bottom': (adminBarHeight + bottomFix) + 'px' 83 }); 84 updateWidgetWidth(widget); 85 } else if (scrollTop >= pushUpElementTop - widget.outerHeight(true)) { 86 var pushUpOffset = pushUpElementTop - (scrollTop + widget.outerHeight(true)) + adminBarHeight; 87 88 widget.css({ 89 'position': 'sticky', 90 'top': (pushUpOffset + marginTop - bottomFixLastPosition) + 'px', 91 }); 92 updateWidgetWidth(widget); 93 } else { 94 widget.css({ 95 'width': 'auto' 96 }); 97 } 98 } 99 }); 100 101 $(window).on('resize', function() { 102 var isGuideOrPeople = $('body').hasClass('single-przewodnik') || $('body').hasClass('single-ludzie'); 103 var isMobileWidth = window.innerWidth < 969; 104 105 if (isGuideOrPeople && isMobileWidth) { 106 widget.css({ 107 'position': 'static', 108 'width': 'auto', 109 'top': 'auto' 110 }); 111 return; 112 } 113 114 var adminBarHeight = wpAdminBar.length && wpAdminBar.is(':visible') ? wpAdminBar.outerHeight() : 0; 115 var stickyNavigationHeight = stickyNavigation.is(':visible') ? stickyNavigation.outerHeight() : 0; 116 if (widget.css('position') === 'sticky') { 117 widget.css('top', (adminBarHeight + marginTop + stickyNavigationHeight) + 'px'); 118 updateWidgetWidth(widget); 119 } 120 }); 121 } 122 }); 123});
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.