PageSourceSearch

https://www.wetenschapscafe.be/scripts/responsive-img.js

js wetenschapscafe.be collected 2026-10-07 02:00:46 UTC 2,305 bytes, 107 lines download raw bytes

1$(document).ready(function() {
2	var old_w = 0;
3	check();
4	
5	function check() {
6		var w=window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
7		if (old_w != w) {
8			if(w<480) {
9				goMobile();
10			}
11			else if (w<768) {
12				goWideMobile();
13			}
14			else if(w<1000) {
15				goTablet();
16			}
17			else {
18				goDefault();
19			}
20			old_w = w;
21		 }
22	}
23
24	$(window).bind('resize', function() {
25		check();
26	});
27
28  
29	function goMobile() {
30		$('img[data-m]').each(function() {
31			this.src = $(this).attr('data-m');
32		});
33		$('iframe[data-m]').each(function() {
34			this.src = $(this).attr('data-m');
35		});
36		$("#btn_nav_mobile").html('<img src="'+config_url+'images/icon-menu.png" />'+$("#nav_mobile .selected").html());
37		$('#nav_main').hide();
38		$('#nav_mobile').show();
39		$('#nav_mobile ul').hide();
40		setScrollHeight();
41	}
42
43	function goWideMobile() {
44		$('img[data-w]').each(function() {
45			this.src = $(this).attr('data-w');
46		});
47		$('iframe[data-w]').each(function() {
48			this.src = $(this).attr('data-w');
49		});
50		$("#btn_nav_mobile").html('<img src="'+config_url+'images/icon-menu.png" />'+$("#nav_mobile .selected").html());
51		$('#nav_main').hide();
52		$('#nav_mobile').show();
53		$('#nav_mobile ul').hide();
54		setScrollHeight();
55	}
56
57	function goTablet() {
58		$('img[data-t]').each(function() {
59			this.src = $(this).attr('data-t');
60		});
61		$('iframe[data-t]').each(function() {
62			this.src = $(this).attr('data-t');
63		});
64		removeBtnMenu();
65	}
66
67	function goDefault() {
68		$('img[data-d]').each(function() {
69			this.src = $(this).attr('data-d');
70		});
71		$('iframe[data-d]').each(function() {
72			this.src = $(this).attr('data-d');
73		});
74		removeBtnMenu();
75	}
76
77	function removeBtnMenu() {
78		if ($("#btn_nav_mobile").length > 0) {
79			$('#nav_main').show();
80			$("#nav_mobile").hide();
81		}
82	}
83
84});
85
86
87function toggle() {
88	$('#nav_mobile ul').slideToggle(
89		"fast", 
90		function() {
91			setScrollHeight();
92		}
93	);
94}
95
96function setScrollHeight () {
97	if($("#nav_mobile ul").is(":hidden")) {
98		$("#banner").show();
99		$("#container").show();
100		$("#footer").show();
101	}
102	else if($("#nav_mobile ul").is(":visible")) {
103		$("#banner").hide();
104		$("#container").hide();
105		$("#footer").hide();
106	}
107}

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.