PageSourceSearch

https://www.rd.com/wp-content/themes/bumblebee/js/sticky-header.js?ver=30.1.1

js rd.com collected 2026-09-24 07:14:48 UTC 2,424 bytes, 82 lines download raw bytes

1/* global jQuery*/
2jQuery(document).ready(function ($) {
3	var siteHeader = $('.header, .main-navigation'),
4		windowWidth = jQuery(window).width(),
5		page = get_page_name();
6
7	//WPDT-8451 : Remove sticky header on mobile from the following pages Currently its for toh fhm rd//
8	var removeStickyHeader = ['project', 'project-legacy', 'listicle', 'post', 'recipe'];
9	function removeStickyOnRecircMobile(page, windowWidth) {
10		siteHeader.addClass('sticky');
11		if (($.inArray(page, removeStickyHeader) > -1) && windowWidth <= 768) {
12			siteHeader.removeClass('sticky');
13		}
14	}
15
16	if (windowWidth < 480) {
17		siteHeaderSticky();
18	}
19
20	function siteHeaderSticky() {
21		var lastScrollTop = 0;
22		$(window).scroll(function () {
23			var st = window.pageYOffset || document.documentElement.scrollTop;
24			if (st <= 180) {
25				siteHeader.removeClass('sticky');
26			} else if (st > 160 && st > lastScrollTop) { //downscroll check
27				if ((page === 'page') && ($('body').hasClass('page-template-page-sandbox-template') && (windowWidth <= 768))) {
28					siteHeader.addClass('sticky');
29				} else {
30					siteHeader.removeClass('sticky');
31				}
32			} else { // upscroll
33				removeStickyOnRecircMobile(page, windowWidth); //WPDT-7508
34			}
35			lastScrollTop = st;//check current scrolltop v/s previous
36		});
37	}
38
39	function get_page_name() {
40		var page_name = '';
41		var body_select = $('body');
42		if (body_select.hasClass('home')) {
43			page_name = 'homepage';
44		} else if (body_select.hasClass('archive')) {
45			page_name = 'hubs';
46		} else if (body_select.hasClass('page')) {
47			page_name = 'page';
48		} else {
49			var class_match = document.body.className.match(/(^|\s)single-(.*?)( |$)/);
50			if (class_match) {
51				page_name = class_match[2];
52			}
53			if (page_name === 'listicle' || page_name === 'collection') {
54				page_name = body_select.hasClass('slideshow-view') ? 'slideshow' : 'listicle';
55			}
56		}
57		return page_name;
58	}
59
60});
61
62// Logos for Native
63jQuery(document).ready(function ($) {
64	$(window).scroll(function () {
65		if ($(window).scrollTop() > 126) {
66			$('.sticky-logo').addClass('show-logo');
67			$('.with_sticky_header').addClass('show-logo');
68		}
69		else {
70			$('.sticky-logo').removeClass('show-logo');
71			$('.with_sticky_header').removeClass('show-logo');
72		}
73	});
74});
75
76// Hide/Show Search Box in mobile.
77jQuery(document).ready(function ($) {
78	$('.search-tap').on('click', function() {
79		$('.search-wrapper').toggleClass('active');
80	});
81});
82

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.