PageSourceSearch

https://dc.gov/themes/custom/dc_agency_new/js/photogallery.js?v=1.x

js dc.gov collected 2026-09-24 06:48:17 UTC 3,058 bytes, 63 lines download raw bytes

1jQuery(document).ready(function() {
2function changeCurrentImage(link, title, alt) {
3  // Check if parameters exist
4  if (!link || !title) {
5    return;
6  }
7
8	// hide larger image before image change
9	jQuery('#gallery #panel').hide();
10	//rewrite largeimage img element scr with new url using agency_home_featured_rotator drupal image style
11	jQuery('#gallery #panel #largeImage').attr('src',link.replace("sites/default/files/", "sites/default/files/styles/agency_home_featured_rotator/public/"));
12	//rewrite largeimage img element alt and title with new title and alt for 508
13	jQuery('#gallery #panel #largeImage').attr('alt',alt);
14	jQuery('#gallery #panel #largeImage').attr('title',title);
15	//rewrite description div element html with title
16	jQuery('#gallery #panel #description').html(title);
17	//fade in slow large image
18	jQuery('#gallery #panel').fadeIn('slow');
19}
20
21var currentImages = jQuery('#gallery .field-items .field-item a');
22var currentImageIndex = 0;
23
24jQuery(currentImages).each(function() {
25	// Strip away all lightbox rel code from image links and Add all href links into rel attribute
26	jQuery(this).attr('rel', jQuery(this).attr('href'));
27	// Replace all href links with #
28	jQuery(this).attr('href', "javascript:void(0)");
29});
30
31//load first image url from current a element and caption from child img element into large image area for default picture to show
32changeCurrentImage(jQuery(currentImages).eq(0).attr('rel'), jQuery(currentImages).eq(0).children().attr('title'), jQuery(currentImages).eq(0).children().attr('alt'));
33
34// Add onclick event for each image thumbnail
35jQuery(currentImages).click(function(){
36	//load current clicked image url and caption into large image area and show
37	changeCurrentImage(jQuery(this).attr('rel'), jQuery(this).children().attr('title'), jQuery(this).children().attr('alt'));
38	//set currentImageIndex to current clicked
39	currentImageIndex = jQuery(currentImages).index(this);
40});
41
42jQuery('#gallery #next').click(function(e){
43	e.preventDefault(); /* prevents default link behavior */
44	if(currentImageIndex >= jQuery(currentImages).length-1){
45		//reset to start
46		currentImageIndex = -1;
47	}
48	currentImageIndex++;
49	//load next image referenced by currentImageIndex url and caption into large image area and show
50	changeCurrentImage(jQuery(currentImages).eq(currentImageIndex).attr('rel'), jQuery(currentImages).eq(currentImageIndex).children().attr('title'), jQuery(currentImages).eq(currentImageIndex).children().attr('alt'));
51});
52
53jQuery('#gallery #previous').click(function(e){
54	e.preventDefault(); /* prevents default link behavior */
55	if(currentImageIndex <= 0){
56		//reset to start
57		currentImageIndex = jQuery(currentImages).length;
58	}
59	currentImageIndex--;
60	//load previous image referenced by currentImageIndex url and caption into large image area and show
61	changeCurrentImage(jQuery(currentImages).eq(currentImageIndex).attr('rel'), jQuery(currentImages).eq(currentImageIndex).children().attr('title'), jQuery(currentImages).eq(currentImageIndex).children().attr('alt'));
62});
63}); //end document.ready

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.