" );
var $containerTextArea = $container.children( "span" );
jQuery( document.body ).append( $container );
this.show = function ( $hoveredItem ) {
var $hoveredItemImg = $hoveredItem.find( "img" );
var text = $hoveredItemImg.attr( "alt" );
var offSet = $hoveredItem.offset();
if ( text.length > 200 ) {
text = text.substring( 0, 199 ) + "...";
}
$containerTextArea.html( text );
var containerHeight = $container.height() + 10 + 12; // 10 = 5px padding; 12 = callout offset
$container.css( { left: offSet.left - 20, top: offSet.top - containerHeight } ).show();
};
this.hide = function () {
$container.hide();
};
};
jQuery( document ).ready( function () {
var $window = jQuery( window );
var $moduleContainer = jQuery( "#dnn_ctr1201_ModuleContent" );
var $slideshowContainer = $moduleContainer.find( ".slideshow-2" );
var $slideshowCollectionElements = $moduleContainer.find( ".slideshow-2-collectiontitle,.slideshow-2-collectiondescription" );
var $slideshowSlideContainer = $slideshowContainer.children( ".slideContainer" );
var $slideshowPagerContainer = $slideshowContainer.children( ".pagerContainer" );
var $slideshowPagerPrevious = $slideshowContainer.children( ".pagerPrevious" );
var $slideshowPagerNext = $slideshowContainer.children( ".pagerNext" );
var windowResizeTimeout = null;
var windowResizeTimeoutInterval = 500;
var pager = {
currentIndex: 0,
isVisible: false,
slidesInView: 0,
height: 0,
manualClick: false,
slideHeight: 65, // includes border and margin
activeArrow: jQuery( "
" ),
slides: $slideshowPagerContainer.children( ".slide" ),
slideCount: 0,
tooltip: new slideshow2Tooltip(),
setSelected: function ( idx ) {
pager.slides.eq( idx ).append( pager.activeArrow );
},
animatePager: function() {
var nextScrollTop = pager.currentIndex * pager.slideHeight;
$slideshowPagerContainer.animate( { scrollTop: nextScrollTop
}, 1000 );
pager.updatePagerButtons( nextScrollTop );
},
updatePagerButtons: function ( scrollTop ) {
var scrollHeight = $slideshowPagerContainer[0].scrollHeight;
var canClickPrevious = scrollTop > 0 && scrollHeight > pager.height;
var canClickNext = scrollTop + pager.height < scrollHeight;
$slideshowPagerPrevious.toggleClass( "pagerDisabled", !canClickPrevious );
$slideshowPagerNext.toggleClass( "pagerDisabled", !canClickNext );
}
};
$(".pagerPrevious").attr("aria-label", "Previous Slides");
$(".pagerNext").attr("aria-label", "Next Slides");
function WindowResize() {
var windowWidth = $window.width();
if ( windowWidth > 1199 ) {
SetPagerVariablesAndUpdateSlideContainerOnResize( true, 9, 582, "slideshow-2-minimum slideshow-2-pager-7 slideshow-2-pager-8", "slideshow-2-pager-9" );
}
else if ( windowWidth > 991 ) {
SetPagerVariablesAndUpdateSlideContainerOnResize( true, 7, 452, "slideshow-2-minimum slideshow-2-pager-8 slideshow-2-pager-9", "slideshow-2-pager-7" );
}
else if ( windowWidth > 767 ) {
SetPagerVariablesAndUpdateSlideContainerOnResize( true, 8, 517, "slideshow-2-minimum slideshow-2-pager-7 slideshow-2-pager-9", "slideshow-2-pager-8" );
} else {
SetPagerVariablesAndUpdateSlideContainerOnResize( false, 0, 0, "slideshow-2-pager-7 slideshow-2-pager-8 slideshow-2-pager-9", "slideshow-2-minimum" );
}
$slideshowPagerContainer.scrollTop( pager.currentIndex * pager.slideHeight );
pager.updatePagerButtons( pager.currentIndex * pager.slideHeight );
}
function SetPagerVariablesAndUpdateSlideContainerOnResize( isVisible, slidesInView, height, removeClasses, addClass ) {
$slideshowContainer.removeClass( removeClasses ).addClass( addClass );
$slideshowCollectionElements.removeClass( removeClasses ).addClass( addClass );
pager.isVisible = isVisible;
pager.slidesInView = slidesInView;
pager.height = height;
}
function AddEvents() {
$window.on( "resize.slideshow-2", function () {
clearTimeout( windowResizeTimeout );
windowResizeTimeout = setTimeout( WindowResize, windowResizeTimeoutInterval );
});
$slideshowPagerContainer.on( "click", ".slide", function () {
var idx = $( this ).index();
pager.manualClick = true;
$slideshowSlideContainer.cycle( "goto", idx );
return false;
});
$slideshowPagerContainer.on("keydown", ".slide", function (e) {
if (e.keyCode == 13 || e.keyCode == 32) {
var idx = $(this).index();
pager.manualClick = true;
$slideshowSlideContainer.cycle("goto", idx);
return false;
}
});
$slideshowPagerPrevious.on( "click", function () {
if ( !$slideshowPagerPrevious.hasClass( "pagerDisabled" ) ) {
var previousIndex = pager.currentIndex - pager.slidesInView;
if ( previousIndex < 0 ) {
previousIndex = 0;
}
pager.currentIndex = previousIndex;
pager.animatePager();
if(false) {
$slideshowSlideContainer.cycle('pause');
}
}
return false;
});
$slideshowPagerPrevious.on("keydown", function (e) {
if (e.keyCode == 13 || e.keyCode == 32) {
if (!$slideshowPagerPrevious.hasClass("pagerDisabled")) {
var previousIndex = pager.currentIndex - pager.slidesInView;
if (previousIndex < 0) {
previousIndex = 0;
}
pager.currentIndex = previousIndex;
pager.animatePager();
if (false) {
$slideshowSlideContainer.cycle('pause');
}
}
return false;
}
});
$slideshowPagerNext.on( "click", function () {
if ( !$slideshowPagerNext.hasClass( "pagerDisabled" ) ) {
var nextIndex = pager.currentIndex + pager.slidesInView;
if ( nextIndex > pager.slideCount - 1 ) {
nextIndex = pager.slideCount - 1;
}
pager.currentIndex = nextIndex;
pager.animatePager();
if(false) {
$slideshowSlideContainer.cycle('pause');
}
}
return false;
});
$slideshowPagerNext.on("keydown", function (e) {
if (e.keyCode == 13 || e.keyCode == 32) {
if (!$slideshowPagerNext.hasClass("pagerDisabled")) {
var nextIndex = pager.currentIndex + pager.slidesInView;
if (nextIndex > pager.slideCount - 1) {
nextIndex = pager.slideCount - 1;
}
pager.currentIndex = nextIndex;
pager.animatePager();
if (false) {
$slideshowSlideContainer.cycle('pause');
}
}
return false;
}
});
$slideshowPagerContainer.on( "mouseenter", ".slide", function () {
pager.tooltip.show( $( this ) );
}).on("mouseleave", ".slide", function () { pager.tooltip.hide(); });
//For screen readers pause/play
$('div.slideContainer').focusout(function () {
$slideshowSlideContainer.cycle('resume');
})
$("div.slideContainer").focusin(function () {
$slideshowSlideContainer.cycle('pause');
});
$('div.pagerContainer').focusout(function () {
$slideshowSlideContainer.cycle('resume');
})
$("div.pagerContainer").focusin(function () {
$slideshowSlideContainer.cycle('pause');
});
}
function Init() {
AddEvents();
WindowResize();
$slideshowSlideContainer.cycle( {
slides: "> .slide",
fx: "fade",
speed: 1000,
timeout: 5000,
pauseOnHover: true,
swipe: true,
prev: "> .slidePrevious",
next: "> .slideNext",
log: false
}).on( "cycle-before", function ( event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag ) {
pager.setSelected( optionHash.nextSlide );
});
pager.slideCount = pager.slides.size();
pager.setSelected( 0 );
pager.updatePagerButtons( 0 );
$slideshowContainer.css( "visibility", "visible" );
}
Init();
});