|
Server : Apache/2.4.62 System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64 User : www ( 80) PHP Version : 8.3.8 Disable Function : NONE Directory : /domains/bluerae/clients/keryx/ir-template/assets/js/ |
Upload File : |
/**
* Starter Theme JS
*
* Title: Starter
* Author: Kevin Leary (kevinleary.net)
*
* // Load CodeKit include scripts into a single file
* // these MUST be commented out, but are still included
* @codekit-prepend "lib/jquery.jtruncate.js"
* @codekit-prepend "lib/jquery.cycle2.js"
* @codekit-prepend "lib/jquery.easyListSplitter.js";
*/
(function ($) {
var StarterTheme = {
/**
* Init Function
*/
init: function () {
this.teamProfiles();
this.truncateText();
this.carousel();
this.navigation();
},
// Slideshow
carousel: function () {
var $carousel = $('.carousel');
if ($carousel.length > 0) {
$carousel.cycle({
timeout: 5000,
speed: 1000,
manualSpeed: 250,
slides: 'article',
log: false,
pager: '.cycle-pager'
});
}
},
/**
* Navigation
*/
navigation: function () {
var $container, $button, menu;
// check for main menu
$container = $('#site-navigation');
if ($container.length <= 0)
return;
// find mobile toggle button
$button = $container.find('.menu-toggle');
if ($button.length <= 0)
return;
// mobile toggle exists
$menu = $container.find('ul.menu');
// hide menu toggle button if menu is empty
if ($menu.length > 0) {
$menu.addClass('nav-menu');
}
else {
$button.hide();
return;
}
// button click actions
$button.on('click', function (e) {
e.preventDefault();
$menu.slideToggle('fast');
$container.toggleClass('toggled');
});
},
/**
* Team profiles
*/
teamProfiles: function () {
var $profiles = $('.profiles');
if ($profiles.length > 0) {
// List splitter
$('.profiles.default').easyListSplitter({
colNumber: 2,
direction: 'horizontal'
});
// Close all event
$(document).on("closeAllExpanded", function (event, triggerId) {
var open = $('.profile.open');
if (open.find('.expand-collapse').attr('id') !== triggerId) {
open
.removeClass('open')
.find('.profile-content').hide();
}
});
// Expand/collapse event handlers
$triggers = $('.expand-collapse');
$triggers.on('click', function (e) {
e.preventDefault();
var $this = $(this);
// Close all expanded content
$(document).trigger("closeAllExpanded", $this.attr('id'));
// Toggle content
$(this)
.parents('.profile')
.toggleClass('open')
.find('.profile-content').slideToggle();
});
}
},
/**
* Truncate Strings
*
* Avoid strings that are too long
*/
truncateText: function () {
var $truncate = $('.truncate');
if ($truncate.length > 0) {
$truncate.each(function () {
var $this = $(this);
var length = $this.data('length');
length = (!length) ? 300 : length;
$this.jTruncate({
length: length,
minTrail: 0,
ellipsisText: "…"
});
});
}
}
}; // end StarterTheme
StarterTheme.init();
})(jQuery);