PageSourceSearch

https://catholic.net/js/jcarousel.js

js catholic.net collected 2026-09-24 08:51:25 UTC 2,723 bytes, 77 lines download raw bytes

1jQuery(document).ready(function(){
2
3	var carousel_container = jQuery('.carousel-container');
4	
5	function carousel_init(){
6		carousel_container.each(function(){
7			var carousel = jQuery(this);
8			var carousel_holder = carousel.children('.carousel-item-holder');
9			var carousel_item = carousel.find('.carousel-item');
10			
11			carousel_item.css('float', 'left');
12			
13			var child_size;
14			if( carousel_item.filter(':first').hasClass('three') ){
15				carousel_holder.attr('data-num', 4);
16				child_size = carousel.parents('.row').width() / 4;
17			}else if( carousel_item.filter(':first').hasClass('four') ){
18				carousel_holder.attr('data-num', 3);
19				child_size = carousel.parents('.row').width() / 3;
20			}else if( carousel_item.filter(':first').hasClass('six') ){
21				carousel_holder.attr('data-num', 2);
22				child_size = carousel.parents('.row').width() / 2;
23			}
24			
25			if( jQuery(window).width() <= '767' ){
26				carousel_holder.attr('data-num', 1);
27				child_size = carousel_item.width() + 15; //carousel.parents('.row').width();
28			}
29
30			child_size += 9;
31			
32			carousel_item.width( child_size );
33			
34			carousel_holder.attr('data-width', child_size);
35			carousel_holder.attr('data-max', carousel_item.length);
36			carousel_holder.width( carousel_item.length * child_size );
37			
38			var cur_index = parseInt(carousel_holder.attr('data-index'));
39			carousel_holder.css({ 'margin-left': -(cur_index * child_size + 12.5) });
40		});
41	}
42	
43	// bind the navigation
44	var carousel_nav = carousel_container.children('.carousel-navigation');
45	carousel_nav.children('.carousel-prev').click(function(){
46		var carousel_holder = jQuery(this).parent('.carousel-navigation').siblings('.carousel-item-holder');
47		var cur_index = parseInt(carousel_holder.attr('data-index'));
48		
49		if( cur_index > 0 ){ cur_index--;  }
50		
51		carousel_holder.attr('data-index', cur_index);
52		carousel_holder.animate({ 'margin-left': -(cur_index * parseInt(carousel_holder.attr('data-width')) + 12.5) });
53	});
54	carousel_nav.children('.carousel-next').click(function(){
55		var carousel_holder = jQuery(this).parent('.carousel-navigation').siblings('.carousel-item-holder');
56		var cur_index = parseInt(carousel_holder.attr('data-index'));
57		
58		if( cur_index + parseInt(carousel_holder.attr('data-num')) < parseInt(carousel_holder.attr('data-max')) ){
59			cur_index++;
60		}
61		
62		carousel_holder.attr('data-index', cur_index);
63		carousel_holder.animate({ 'margin-left': -(cur_index * parseInt(carousel_holder.attr('data-width')) + 12.5) });
64	});
65	
66	carousel_init();
67	
68	//Auto animate
69	//var infiniteLoop = setInterval(function(){
70	//	carousel_nav.children('.carousel-next').trigger('click');
71	//}, 1000);	
72	
73	jQuery(window).resize(function(){
74		carousel_init();
75	});
76	
77});

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.