var startColor = "#39DAFF";
var endColor = "#004B4F";
var map;
var animating = false;
var mapanimating = false;
function incrementCountUp(ele, val, targetVal, dur, increment)
{
ele.closest(".metric").addClass("animated")
if (val < targetVal)
{
val=val+increment;
ele.text(val);
setTimeout(function(){incrementCountUp(ele, val, targetVal, dur, increment)}, dur, ele, val, targetVal, dur, increment)
}
else
ele.text(targetVal);
}
function handleAnchor(href, e, scrollDuration)
{
if (href.charAt(0) == "#")
{
var name = href.replace("#", "");
var $ele = $("[name='"+name+"']");
if ($ele.length>0)
{
e.preventDefault();
e.stopPropagation();
$("#left-sidebar a.is-the-current").removeClass("is-the-current")
$("#left-sidebar a[href='"+e.target.href+"']").addClass("is-the-current")
headerHeight = $("#header").outerHeight(true);
$("html, body").animate({ scrollTop: $ele.offset().top - headerHeight}, scrollDuration);
window.location.hash = href;
}
}
}
function manualColors()
{
if (typeof color_array == "undefined")
return [
"#21a6dc",
"#764593",
"#f0b257",
"#99c355",
"#949598",
"#153251",
"#459376",
"#934562",
"#456293",
"#937645",
];
else
return color_array;
}
/*
this function increments the metrics animation counter(s) in a page section
**/
function incrementCounter($metrics, loopcount)
{
var cont = false;
$running = $metrics.filterData('status', 0);
$running.each(function(){
if (isNaN($(this).data("to")) == false)
{
$current = parseFloat($(this).data("cur"));
$target = parseFloat($(this).data("to"));
$increment = $(this).data("inc");
prec = parseInt(getPrecision ($target));
/*if ($increment > 1)
next = ($current + Math.round($increment));
else if (prec == 0)
next = ($current + $increment);
else*/
next = ($current + $increment)
$(this).data("cur", next);
if (isNaN(next))
t = next
else
t = new Intl.NumberFormat().format(next.toFixed(prec));
$(this).find("span").text(t);
if (next <= $target)
cont = true;
else
{
if (isNaN($target))
v = $target
else
v = new Intl.NumberFormat().format($target.toFixed(prec));
$(this).find("span").text(v)
$(this).data("status", "1");
}
}
/*else if(isNaN($(this).data("to").remove(" - ")) == false)
{
console.log("Multiple numbers")
}*/
else
{
$(this).data("status", "1");
$metrics.remove($(this));
loopcount=0;
}
})
if (loopcount % 500 == 0)
{
$filtered = $metrics.filterData('status', -1);
$filtered.first().data("status", "0").addClass("animated");
}
loopcount += 10;
$running = $metrics.filterData('status', 0);
if ($running.length > 0)
setTimeout(function(){incrementCounter($metrics, loopcount)}, 10, $metrics, loopcount);
}
/*
this function initializes the metrics animation counter(s) in a page section
**/
function initializeCounter($container)
{
$metrics = $container.find(".metric");
incrementCounter($metrics, 0);
}
/*
this function handles the animation and appearance of elements in a page section.
it includes:
- animated metrics
- bar charts
- pie charts
- combo charts
**/
function triggerVisuals($ele)
{
/*$ele.find(".count-up .counter").each(function(){
var $val = $(this).data("value");
$(this).find("span").text(0);
var $dur = 1000 / $val;
var $ele = $(this).find("span")
var $offset = $(this).index() * 500;
$timer = setTimeout(function(){incrementCountUp($ele, 0, $val, $dur);}, $offset, $ele, 0, $val, $dur);
$(this).data("timer", $timer);
});*/
// animated metrics
if ($ele.find(".metrics.animate .metric").length > 0)
initializeCounter($ele.find(".metrics.animate"))
// bar charts
$ele.find(".bar_chart_container").each(function(){
if ($(this).find(".boundary-line").length > 0)
{
height = $(this).find(".display").innerHeight()
$(this).find(".boundary-line").animate({"height": height}, 1000);
}
})
$ele.find(".graph-wrapper").each(function(){
var $ele = $(this)
var $graphdata = $(this).data("graph");
for(i=0;i<$graphdata.length;i++)
{
var $data = $graphdata[i];
var $graph = $data.value;
var $rows = $data.rows;
var $cols = $data.cols;
var $delay = $data.delay;
var $caption = $data.caption;
var $subcaption = $data.subcaption;
if (typeof $delay === "undefined")
$delay = 1;
var $cellH = 100 / $rows;
var $cellW = 100 / $cols;
var $out = $("
");
var $count = 0;
var $class = " animated";
for(row = 0;row < $rows; row++)
{
var $row = $("");
for(col = 0;col < $cols; col++)
{
if ($count >= $graph)
$class = " off";
$count++;
$row.append("");
}
$out.append($row)
}
$out.children().each(function(i,div){$out.prepend(div)})
if ($out.length > 0)
{
$container = $('')
$container.append(''+$caption+'
'+$subcaption+'
')
$container.find(".graph-bars").append($out)
interpolateColors($container.find(".graph-bars .graph-box"), startColor, endColor)
$ele.append($container)
}
}
if ($ele.find(".graph").length > 0)
{
if ($ele.find(".graph").length > 1)
{
setInterval(function(element){
element.removeClass("running")
var $ele = element.find(".graph.on")
var $next = $ele.next(".graph")
if ($next.length == 0)
$next = element.find(".graph").first()
$ele.removeClass("on");
$next.addClass("on");
element.addClass("running")
}, 8000, $ele)
}
}
$ele.find(".graph:first").addClass("on");
$ele.addClass("running");
})
// pie charts
$ele.find(".pie-chart-wrapper").each(function(){
$(this).find(".pie-chart").each(function(){
var $container = $(this);
var $data = $(this).data("data");
var $legend = $(this).data("legend");
var $legendposition = $(this).data("legend-position");
var $units = $(this).data("units");
var legend = "";
if (typeof $legend == "undefined")
$legend = false;
else
$legend = ($legend==true);
if (typeof $legendposition == "undefined")
$legendposition = "side";
$(this).addClass("legend-position-"+$legendposition)
var $donut = $(this).data("donut");
if (typeof $donut == "undefined")
$donut = false;
else
$donut = ($donut===true);
var r = 100 / (2 * Math.PI);
$count = $data.length;
colors = manualColors()
for(i=0;i<$count;i++)
{
$data[i].color = colors[i];
legend += (" | "+$data[i]["title"]+" |
")
}
var showValues = $(this).data("showvalues");
$container.drawPieChart($data, {"showValues":showValues,"units": $units});
if ($donut==true)
{
var center = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
center.setAttribute("cx", 250);
center.setAttribute("cy", 250);
center.setAttribute("r", 100);
center.setAttribute("fill", "#ffffff");
$container.addClass("donut").find("svg").append(center);
}
else
{
var center = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
center.setAttribute("cx", 250);
center.setAttribute("cy", 250);
center.setAttribute("r", 100);
center.setAttribute("fill", "#ffffff");
$container.find("svg").prepend(center);
}
if ($legend==true)
{
$container.append("")
}
})
});
// combination charts
$ele.find(".combo-chart").each(function(){
var $bars = $(this).find("rect.bar");
var $line = $(this).find("polyline.line");
var $points = $(this).find("circle.point");
var $combo = $bars.add($points);
var $tooltip = $(this).find(".tooltip");
// bar hover
$bars.hover(function(e){
$(this).closest(".combo-chart").addClass("bar-hover");
}, function(){
$(this).closest(".combo-chart").removeClass("bar-hover");
$tooltip.removeClass("visible").empty().css({left: "0px",top: "0px"});
})
// point hover
$points.hover(function(e){
$(this).closest(".combo-chart").addClass("point-hover");
}, function(){
$(this).closest(".combo-chart").removeClass("point-hover");
$tooltip.removeClass("visible").empty().css({left: "0px",top: "0px"});
})
// bar & point hover & mouse movement
$combo.hover(function(e){
$(this).addClass("hover");
val = $(this).data("value");
caption = $(this).data("caption");
preunits = $(this).data("preunits");
postunits = $(this).data("postunits");
div = $(""+caption+": "+preunits+val+postunits+"
");
$tooltip.append(div).css({left: (e.offsetX+15)+"px",top:(e.offsetY+15)+"px"}).addClass("visible");
}, function(){
$(this).removeClass("hover");
$tooltip.removeClass("visible").empty().css({left: "0px",top: "0px"});
})
$combo.mousemove(function(e){
$tooltip.css({left: (e.offsetX+15)+"px",top:(e.offsetY+15)+"px"})
})
})
}
function resetVisuals($ele)
{
}
function scrollToElement($ele, $duration)
{
}
/*
this function renders a map on the page.
parameters:
mapAccessToken: the mapbox api token
mapCenter: the initial center point of the map. the bounds/center will be calculated and the map will animate to the new center point
mapStyle: the map styler JSON
mapData_States: the state(s) to highlight
mapData_Elements: the areas to highlight and make clickable/assign a popup to
mapData_Points: individual points to highlight and make clickable/assign a popup to
**/
function render_map(mapAccessToken, mapCenter, mapStyle, mapData_States, mapData_Elements, mapData_Points)
{
/*
this function registers map popup click events
**/
function register_map_events()
{
$("#map-container .popup-content a.button").on("click", function(e){
var href = $(this).data("href");
console.log($("[name='"+href+"']"))
if ($("[name='"+href+"']").length > 0)
{
handleAnchor("#" + href, e, 400)
}
});
$("#map-container .popup-content a.close").on("click", function(){
map.flyTo(mapCenter)
$("#map .map-overlay").removeClass("visible")
setTimeout(function(){
$("#map .map-overlay").empty();
}, 1000)
})
}
/*
this function integrates longitude/latitude coordinates into the current bounding box
**/
function getBoundingBox(coordinates) {
var bounds = {}, coords, point, latitude, longitude;
for (var j = 0; j < coordinates.length; j++) {
longitude = coordinates[j][0];
latitude = coordinates[j][1];
bounds.xMin = bounds.xMin < longitude ? bounds.xMin : longitude;
bounds.xMax = bounds.xMax > longitude ? bounds.xMax : longitude;
bounds.yMin = bounds.yMin < latitude ? bounds.yMin : latitude;
bounds.yMax = bounds.yMax > latitude ? bounds.yMax : latitude;
}
return bounds;
}
/*
this function creates a map popup
**/
function createPopup(feature, lnglat)
{
var h_id = feature.properties.id;
var h_caption = feature.properties.caption;
var h_details = feature.properties.details;
var h_state = feature.properties.state;
if (h_state.length > 0)
h_state = ""+h_state+"
";
var h_img = feature.properties.img;
if (h_img.length > 0)
h_img = ""+h_state+"
"
var h_target = feature.properties.target;
if (h_target.length > 0)
h_target = "Learn More"
var h_left = "";
if (h_img.length > 0 || h_target.length > 0)
h_left = ""+h_img + h_target+"
"
// create the overlay
var html = ""
var popup = $("#map-container").append(html)
return popup;
}
/*
this function hides a map popup and recenters the map on the bounding box
**/
function hidePopup()
{
$(".popup-content").fadeOut(300);
mapfit();
}
/*
this function shows a map popup
**/
function showPopup(f_type, f_id)
{
$eleId = f_type+"-"+f_id
if ($(".popup-content:not(#map-"+$eleId+")").length > 0)
$(".popup-content:not(#map-"+$eleId+")").fadeOut(300, function(){
$("#map-"+$eleId).fadeIn(300)
})
else
$("#map-"+$eleId).fadeIn(300)
}
/*
this function fits the map to the boundary box
**/
function mapfit()
{
map.fitBounds(bounds, {padding:{top:40,bottom:40,left:40,right:40}});
}
// initialize the variables and create the map
bounds = new mapboxgl.LngLatBounds();
mapboxgl.accessToken = mapAccessToken;
var fillArr = [];
var popup;
var mapCenter = mapCenter;
// create a new map
map = new mapboxgl.Map({
container: 'mapbox',
style: mapStyle,
zoom: 2,
maxZoom: 5,
center: mapCenter,
trackResize: true
});
// on resize
map.on("resize", function(){
// hide the popup and center the map and rezoom
hidePopup();
})
// when map is loaded
map.on('load', function () {
// create an array of markers
var markers = [];
// create a bounding box variable
bounds = new mapboxgl.LngLatBounds();
// get the top layer that has symbols
var layers = map.getStyle().layers;
var firstSymbolId;
for (var i = 0; i < layers.length; i++) {
if (layers[i].type === 'symbol') {
firstSymbolId = layers[i].id;
break;
}
}
// add the state data
map.addSource("map-states", {
"type": "geojson",
"data": mapData_States
});
// add the state fill layer to draw and shade the states and insert them under the state name labels
map.addLayer({"id": "map-state-fills","type": "fill","source": "map-states","layout": {},interactive: true,"paint": {"fill-color": "#003057","fill-opacity": 0.25}}, firstSymbolId);
// add the state fill layer to draw and shade the states and insert them under the state name labels
map.addLayer({"id": "map-state-hover","type": "fill","source": "map-states","layout": {},interactive: true,"paint": {"fill-color": "#003057","fill-opacity": 0.35},"filter": [ '==', 'id', '' ]}, firstSymbolId);
// add the operating area hover state layer
map.addLayer({"id": "map-state-clicked","type": "fill","source": "map-states","layout": {},"paint": {"fill-color": "#003057","fill-opacity": 0.35},"filter": [ '==', 'id', '' ]}, firstSymbolId);
// expand the bounding box for each state
mapData_States.features.forEach(function(feature) {
feature.geometry.coordinates.forEach(function(coord)
{
bounds.extend(coord);
})
});
// if there are map elements defined
if (typeof mapData_Elements !== "undefined")
{
// add the "elements" layer to the active layers list
fillArr.push('map-elements-fills');
// add the operating area data
map.addSource("map-data", {"type": "geojson","data": mapData_Elements});
// add the operating area fill layer to draw and shade the aresa and insert them under the state name labels
map.addLayer({"id": "map-elements-fills","type": "fill","source": "map-data","layout": {},interactive: true,"paint": {"fill-color": "#003057","fill-opacity": 0.5,"fill-outline-color": "#003057"}});
// add the operating area hover state layer
map.addLayer({"id": "map-elements-hover","type": "fill","source": "map-data","layout": {},"paint": {"fill-color": "#00a9e0","fill-opacity": 1,"fill-outline-color": "#003057"},"filter": [ '==', 'id', '' ]});
// add the operating area hover state layer
map.addLayer({"id": "map-elements-clicked","type": "fill","source": "map-data","layout": {},"paint": {"fill-color": "#f0b257","fill-opacity": 1,"fill-outline-color": "#003057",},"filter": [ '==', 'id', '' ]});
// expand the bounding box for each element and create a popup for it
mapData_Elements.features.forEach(function(feature) {
feature.geometry.coordinates.forEach(function(coord)
{
bounds.extend(coord);
})
popup = createPopup(feature);
});
}
// if there are points defined
if (typeof mapData_Points!== "undefined")
{
// add the "points" layer to the active layers list
fillArr.push('map-points-fills');
// add the operating area data
map.addSource("map-data-point-list", {"type": "geojson","data": mapData_Points});
// add the points fill layer
map.addLayer({"id": "map-points-fills","type": "circle","source": "map-data-point-list","layout": {},interactive: true,"paint": {"circle-color": "#003057","circle-radius": 12,'circle-stroke-width': 1,}});
// add the points hover state layer
map.addLayer({"id": "map-points-hover","type": "circle","source": "map-data-point-list","layout": {},"paint": {"circle-color": "#00a9e0","circle-radius": 10,"circle-opacity": 1},"filter": [ '==', 'id', '' ]});
// add the points hover state layer
map.addLayer({"id": "map-points-clicked","type": "circle","source": "map-data-point-list","layout": {},"paint": {"circle-color": "#f0b257","circle-radius": 10,},"filter": [ '==', 'id', '' ]});
// expand the bounding box for each element and create a popup for it
mapData_Points.features.forEach(function(feature) {
popup = createPopup(feature);
bounds.extend(feature.geometry.coordinates);
})
}
center = bounds.getCenter()
// fit the map to the bounding box
bounds = [[bounds["_sw"].lng, bounds["_sw"].lat], [bounds["_ne"].lng, bounds["_ne"].lat]];
mapfit()
// configure the "hover" event
map.on("mousemove", function(e) {
// limit to the fill layers only
var features = map.queryRenderedFeatures(e.point, {
layers: fillArr
});
// if we aren't over a fill layer then remove the hover states and reset the cursor
if (!features.length) {
for(i=0;i .metric").each(function(){
var p = $(this).find("p");
if (p.outerHeight(true) > 18)
{
p.addClass("align-left")
}
else
{
p.removeClass("align-left")
}
})
}
function setSidebarPosition()
{
var headerHeight = $("#header").outerHeight(true);
if ($("#left-sidebar").length > 0)
{
if (($("#left-sidebar").offset().top-$(document).scrollTop() <= headerHeight) && ($("#left-sidebar:not(.pinned)")))
{
$("#left-sidebar").addClass("pinned").css("top", headerHeight)
}
else
if (($("#left-sidebar").offset().top-$(document).scrollTop() > headerHeight))
{
$("#left-sidebar").removeClass("pinned").css("top", "auto")
}
}
}
var bannerRotator = "";
function changeslide($container, $dir)
{
var $children = $container.find("> div");
var $active = $container.find("> div.active");
var $index = $active.index()
$next = 0;
$nextIndex = 0;
if ($dir == "next")
{
if ($active.next().length > 0)
{
$next = (100 / $children.length ) * ($active.next().index());
$nextIndex = $active.next().index();
}
}
else
{
$next = $children.last();
$nextIndex = $children.last().index();
if ($active.prev().length > 0)
{
$next = (100 / $children.length ) * ($active.prev().index());
$nextIndex = $active.prev().index();
}
}
$container.css({"transform": "translateX(-"+$next+"%) translateZ(0)"});
$active.removeClass("active");
$children.eq($nextIndex).addClass("active")
$container.siblings(".captions-container").find(".selector li").removeClass("active").eq($nextIndex).addClass("active")
$container.siblings(".captions-container").find("a.caption-wrapper").removeClass("active").eq($nextIndex).addClass("active")//.closest(".captions").css({"transform": "translateX(-"+$next+"%) translateZ(0)"});
}
function makebannerRotator()
{
if ($(".banner-rotator").length == 1)
{
var $screenWidth = $("body").outerWidth(true);
var $br = $(".banner-rotator");
$(".banner-rotator").prependTo(".main-content-wrapper");
var $container = $br.find(">.container");
var $captions = $container.siblings(".captions-container").find("a.caption-wrapper");
var $children = $container.find("> div");
var $duration = $br.data("duration");
var $transition = $br.data("transition");
$children.first().addClass("active");
$captions.first().addClass("active");
$container.siblings(".captions-container").find(".selector li").removeClass("active").first().addClass("active")
var $count = $children.length;
if ($transition == "slide")
{
if ($(window).width()){
$container.addClass("slide").css({"width": ($count * 100) + "vw", "transform": "translateX(0)"});
$children.css({"width": (100 / $count) + "%"});
$children.find(".bg").each(function(){
$(this).width($screenWidth)
});
bannerRotator = setInterval(function(){changeslide($container, "next")} , 8000, $container);
} else {
}
// $container.addClass("slide").css({"width": ($count * 100) + "vw", "transform": "translateX(0)"});
// $children.css({"width": (100 / $count) + "%"});
// $children.find(".bg").each(function(){
// $(this).width($screenWidth)
// });
// bannerRotator = setInterval(function(){changeslide($container, "next")} , 8000, $container);
}
$br.find("a.arrow").on("click", function(){
clearInterval(bannerRotator);
$dir = $(this).data("dir");
changeslide($container, $dir);
bannerRotator = setInterval(function(){changeslide($container, "next")} , 8000, $container);
})
}
}
$(document).ready(function(){
var $screenWidth = $("body").outerWidth(true);
makebannerRotator();
// post archive link click handler
$(".archive-type-video a").each(function(){
href = $(this).attr("href");
if ((typeof(href) !== "undefined") && (href.substring(0, 29) == "http://www.youtube.com/embed/"))
$(this).featherlight({type: "iframe"})
})
$(".archive-type-image a").each(function(){
href = $(this).attr("href");
if ((typeof(href) !== "undefined") && (href.substr(href.length-4) != ".zip"))
$(this).featherlight()
})
$(".archive-type-publication a, .archive-type-news-release a").each(function(){
href = $(this).attr("href");
if ((typeof(href) !== "undefined") && (href.substring(0, 29) == "http://www.youtube.com/embed/"))
$(this).attr("target", "_blank");
});
// expandable slide click handler
$(".expandable .expandable-header").on("click", function(){
$(".expandable li.expanded").not($(this).closest("li")).removeClass("expanded").find(".expandable-content").slideUp(400);
$(this).siblings(".expandable-content").slideToggle(400);
$(this).closest("li").toggleClass("expanded");
});
// intercept anchor clicks to see if they are internal. If so, scroll smoothly instead of jumping
$("a").on("click", function(e){
href = $(this).attr("href");
var url = document.createElement('a');
url.href = href;
var urlHref = url.pathname;
var urlHash = url.hash;
if (typeof(href) !== "undefined")
if (((window.location.pathname == urlHref) && (urlHash.length > 0)) || (urlHash.length > 0))
handleAnchor(urlHash, e, 500);
})
// expandable tiles slide click handler
$(".expandable-tiles .expandable-header").on("click", function(e){
if (animating == false)
{
var $ele = $(this);
var $container = $ele.closest(".expandable-tiles");
var $item = $ele.closest(".expandable-item");
var $delay = 0;
if ((!($item.hasClass("expanded"))) || ($container.find(".expandable-item.expanded").not($item).length > 0))
{
animating = true;
var $ind = $item.index();
if ($container.find(".expandable-item.expanded").length > 0)
{
$container.find(".expandable-item").removeClass("expanded").animate({"padding-bottom": 0}, 200, "linear");
$container.find(".expandable-content-cloned").slideUp(200, "linear").removeClass(".expandable-content-cloned");
$delay = 200;
}
$item.delay($delay).animate({"padding-bottom": 0}, 0, function(){
var clone = $container.find(".expandable-content").eq($ind);
var cloneH = clone.outerHeight(true);
var pos = ($item.offset().top - $container.offset().top) + $item.outerHeight(true);
clone.css("top", pos).css("left", 0).addClass("expandable-content-cloned").slideDown(200, "linear");
$item.animate({"padding-bottom": cloneH}, 200, "linear", function(){
animating = false;
}).addClass("expanded");
})
}
}
});
//
$(".chart .marker-detail").hover(function(){
var caption = $(this).parent().data("caption");
var $data = $(this).parent().data("data");
$(this).closest(".chart").siblings(".chart-details").find(">div li").each(function(){
var $point = $(this).data("point");
$(this).find("span").html($data[$point])
})
}, function(){
$(this).closest(".chart").siblings(".chart-details").find(">div li").each(function(){
var $default = $(this).data("default");
$(this).find("span").html($default);
})
})
// bar charts
$(".bar_charts.initial-table").find(".bar_chart, .data_table").slideToggle()
$(".bar_charts.initial-table").find(".heading > div").css("display", "none")
$(".bar_chart_container > div.heading .chart-datatable-toggles a").on("click", function(){
var $class = $(this).data("class");
$(this).closest(".bar_chart_container").find(".bar_chart, .data_table, .color-legend").slideToggle();
})
// superscript anchor click handler
$("sup a").on("click", function(){
var data = $(this).text();
$(".legend ol li").removeClass("highlight")
if ($(".legend ol li").eq(data-1).length > 0)
{
var $ele = $(".legend ol li").eq(data-1);
$ele.addClass("highlight");
headerHeight = $("#header").outerHeight(true);
$("html, body").animate({ scrollTop: $ele.offset().top - headerHeight}, 500);
setTimeout(function(){
$ele.removeClass("highlight");
}, 3000)
}
})
/*
// sidebar anchor click handler
$(".sidebar-menu a").on("click", function(e){
var href = $(this).attr("href");
handleAnchor(href, e, 500);
})
*/
// expandable inline click handler
$(".expandable-inline > li > h4").on("click", function(){
$(this).siblings("ul").slideToggle(400);
$(this).parent().toggleClass("expanded");
})
// expandable inline scroller click handler
$(".expandable-inline a.internal-toggle").on("click", function(){
var toggle = $(this).data("toggle");
var target = $(".expandable-inline a[name='"+toggle+"']");
if (target.length > 0)
{
target.closest(".expandable-inline > li").addClass("expanded").find(">ul").slideDown(400);
headerHeight = $("#header").outerHeight(true);
$("html, body").animate({ scrollTop: target.offset().top - headerHeight}, 500);
}
})
// homepage banner rotator
$(" .full-width-banner:not(.banner-rotator .full-width-banner) .bg").each(function(){
$(this).width($screenWidth).css("margin-left", (($(this).parent().outerWidth(true) - $screenWidth) / 2 ));
})
// attach the right sidebar to the content container
if ($("#right-sidebar").length>0)
{
var target = $(".content-container");
$("#right-sidebar").prependTo(target)
}
// map creation
if ($("#map-container").length > 0)
render_map(mapAccessToken, mapCenter, mapStyle, mapData_States, mapData_Elements, mapData_Points);
// size & layout the metrics
sizeMetrics();
// handle the sidebar position if the screen isn't at the top
setSidebarPosition();
// on screen resize
$(window).on("resize", function(){
var $screenWidth = $("body").outerWidth(true);
$(".full-width-banner .bg").each(function(){
$(this).width($screenWidth);
})
sizeMetrics();
})
// on document scroll
$(document).on("scroll", function(e){
setSidebarPosition();
$('#content .content-container > *').each(function(){
if ($(this).visible( true ))
{
if (!($(this).hasClass("visible-on-screen")))
triggerVisuals($(this));
$(this).addClass("visible-on-screen")
}
})
})
})
//plyr js
// const player = new Plyr('#player');
// on load
$(window).on("load", function(e){
if (window.location.hash != "")
handleAnchor(window.location.hash, e, 0);
$("body").addClass("page-loaded");
h = $("#content").outerHeight(true);
if (h < $(window).height() - $("#header").outerHeight(true))
$("#content .main-content-wrapper").css("min-height", $(window).height() - $("#header").outerHeight(true) - $("#banner").outerHeight(true) - $("#footer").outerHeight(true))
$('#content .content-container > *').each(function(){
if ($(this).visible( true ))
{
if (!($(this).hasClass("visible-on-screen")))
triggerVisuals($(this));
$(this).addClass("visible-on-screen")
}
})
})