The Census Carousel Component allows the content author to present content in a navigable carousel. It allows you to a display a selection of rotating images with a title, brief description and link to an associated story, event, program, or page elsewhere in the site. Component has a minimum of 3 items and a maximum of 5 items.
View on public site:
Use a Census Carousel component when you have a set of featured content (pages with images or videos) that you want to display. The Carousel component can be placed on any page in the site.
The Carousel Component presents content in a navigable carousel, with a minimum of 3 items and a maximum of 5 items.
The component displays a series of sliding images, one at a time, in an order the author specifies. Selectable controls also let visitors cycle through the displayed pages on demand.
Enter a description here.
The configure dialog allows the content author to add and rearrange slides. Expand the sections below to learn more about the Carousel's dialog box.
The General tab provides the option to customize the following fields of the Carousel component:
Use the Add button to choose a page to add as a tab in the Carousel.
Once added, an entry is added to the list, which contains the following fields:
Expand the sections below to see the Census Carousel Component's HTML and JS output.
// CAROUSEL
var photoObjectArray = [
{
image: 'https://picsum.photos/1000/200/?random',
title: 'NAICS Code Lookup',
desc: 'Look up a NAICS code by keyword or industry',
button: 'Naics Lookup'
},
{
image: 'https://picsum.photos/1100/400/?random',
title: 'Quick Facts',
desc: 'Look up a Quick facts by keyword ',
button: 'Quick Facts'
},
{
image: 'https://picsum.photos/1200/500/?random',
title: 'American Fact Finder',
desc: 'Learn About up a American Fact Finder ',
button: 'Americn FactFinder'
},
{
image: 'https://picsum.photos/100/400/?random',
title: 'Population Clock',
desc: 'The population clock of the world',
button: 'Population Clock'
},
{
image: 'https://picsum.photos/1000/700/?random',
title: 'Census Business Builder',
desc: 'Census Business Builder Page',
button: 'Business Builder'
}
];
// CAROUSEL BUTTONS
var currentObject = photoObjectArray[0];
var currentObjectIndex = 0;
$('.uscb-next-spec').click(function () {
if (currentObjectIndex === photoObjectArray.length - 1) {
currentObjectIndex = 0;
} else {
++currentObjectIndex;
}
currentObject = photoObjectArray[currentObjectIndex];
$('#uscb-carousel-img-spec').attr('src', currentObject.image);
$('#uscb-carousel-img-spec').attr('alt', currentObject.desc);
$(".uscb-spec-header").text(currentObject.title);
$('.uscb-spec-desc').text(currentObject.desc);
$('.uscb-spec-button').text(currentObject.button);
// remove active class
$('.uscb-carousel-spec-mini').each(function (index, element) {
$(element).removeClass('uscb-active-carousel-special');
})
$($(".uscb-carousel-spec-mini")[currentObjectIndex]).addClass('uscb-active-carousel-special');
// dots used on special container mobile
// remove active class
$('.uscb-dot-spec').each(function (index, element) {
$(element).removeClass('uscb-active-carousel');
})
$($(".uscb-dot-spec")[currentObjectIndex]).addClass('uscb-active-carousel');
});
$(".uscb-prev-spec").click(function () {
if (currentObjectIndex <= 0) {
currentObjectIndex = photoObjectArray.length - 1;
} else {
currentObjectIndex--;
}
currentObject = photoObjectArray[currentObjectIndex];
$('#uscb-carousel-img-spec').attr('src', currentObject.image);
$('#uscb-carousel-img-spec').attr('alt', currentObject.desc);
$(".uscb-spec-header").text(currentObject.title);
$('.uscb-spec-desc').text(currentObject.desc);
$('.uscb-spec-button').text(currentObject.button);
// remove active class
$('.uscb-carousel-spec-mini').each(function (index, element) {
$(element).removeClass('uscb-active-carousel-special');
})
$($(".uscb-carousel-spec-mini")[currentObjectIndex]).addClass('uscb-active-carousel-special');
// dots used on special container
// remove active class
$('.uscb-dot-spec').each(function (index, element) {
$(element).removeClass('uscb-active-carousel');
})
$($(".uscb-dot-spec")[currentObjectIndex]).addClass('uscb-active-carousel');
});
$(document).ready(function () {
$($(".uscb-dot-spec")[currentObjectIndex]).addClass('uscb-active-carousel');
$('#uscb-carousel-img-spec').attr('src', currentObject.image);
$('#uscb-carousel-img-spec').attr('alt', currentObject.desc);
$($(".uscb-carousel-spec-mini")[currentObjectIndex]).addClass('uscb-active-carousel-special');
})
// Create the preview below carousel
$.each(photoObjectArray, function (index, value) {
$('.uscb-dot-container-special').append('<div class="uscb-layout-column uscb-carousel-spec-mini "> <img class="uscb-flex-col-55" src="' + value.image + '" alt=""/> <div class="uscb-flex-col-45 uscb-layout-row uscb-layout-align-center-center"> <p class="uscb-title-3">' + value.title + '</p></div> </div>');
});
// Create the small dots below carousel
$.each(photoObjectArray, function (index, value) {
$('.uscb-dot-container-spec').append('<span class="uscb-dot-spec" ></span>');
});