");
$('#top-header h1').insertAfter( $('.admin-toggle') );
$('#top-nav').insertAfter( $('#top-header h1'));
$('#top-header .clear').insertAfter($('#top-nav'));
$('#top-header').css({'width':'100%','max-width':'100%'});
$('.mobile-toggle-wrap').wrap("");
$('.gf-menu-container').insertAfter($('.mobile-toggle-wrap'));
}
// ==========================================
// SMOOTH SCROLL TO ANCHOR
// ==========================================
$(function() {
// Check if the URL hash is #interactive-field-section
if (window.location.hash === '#interactive-section') {
// Scroll to the element with some offset
$('html, body').animate({
scrollTop: $('#interactive-section').offset().top - 100 // Adjust '100' for desired space
}, 500); // Adjust '500' for scrolling speed in milliseconds
}
});
$(function() {
$('a.scroll-anchor').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
var offset = target.offset().top;
// Check if the device is desktop
if (window.matchMedia("(min-width: 1150px)").matches) {
offset -= 95; // Adjust offset for desktop
}
$('html,body').animate({
scrollTop: offset
}, 0);
return false;
}
}
});
}, 500);
// ==========================================
// REMOVE INLINE STYLES
// ==========================================
function removeInlineStyle(element){
if(element) {
$(element).removeAttr('style');
}
}
// =======================================================
// DOCUMENT READY
// =======================================================
$(function(){
// =======================================================
// ADD 'custom' CLASS TO BODY
// =======================================================
$('body').addClass('custom-design');
// =======================================================
// HEADER, NAVIGATION, LOGO-HEADER - DISPLAY BLOCK
// =======================================================
$('#header, #navigation').css({'display':'block'});
// ==========================================
// TARGET SELF FIX - TEMPORARY
// ==========================================
$('a[target="Self"]').each(function(){
$(this).attr('target','_self')
})
// =======================================================
// WRAP TOP HEADER INTO A DIV
// =======================================================
$('#top-header').wrap('');
$('#top-header').wrap('');
// =======================================================
// PERFORM - RETURN TO NORMAL FUNCTION
// =======================================================
returnToNormal();
// =======================================================
// CUSTOM NAV SCRIPTS - see also window resize
// =======================================================
// INSERT CUSTOM MOBILE NAV AFTER THE HEADER
// INSERT CUSTOM HEADER TO HEADER
$('#custom-header').insertBefore('#header');
$('#navigation').prependTo('.header-right');
$('#top-section').prependTo('.header-right');
$('#mobile-navigation').insertBefore('#custom-header');
$('.fundssocial').insertBefore('#custom-header');
$('#custom-footer').insertBefore('#footer');
// CLONE TOP NAV ITEMS AND APPEND TO MOBILE-NAV-ADMIN-CONTENT
$('#top-nav ul').clone().appendTo($('#mobile-nav-admin-content'))
// CLONE TOP NAV ITEMS AND APPEND TO MOBILE-NAV-ADMIN-CONTENT
$('.gf-menu').clone().appendTo($('#mobile-nav-content'))
// ADD ARROWS TO MENU ITEMS WITH SUBMENU
$('#navigation ul.gf-menu li').each(function(){
if ( $(this).find('ul').length > 0 ) {
$(this).children('a').append('');
}
})
// MOBILE NAV MENU CLICK
$('.mobile-menu').click(function(){
$('#mobile-nav-content').toggle();
$('#mobile-nav-admin-content').hide();
$(this).find('span.fas').toggleClass('fa-bars fa-times');
})
// MOBILE NAV ADMIN MENU CLICK
$('.mobile-admin-menu').click(function(){
$('#mobile-nav-content').hide();
$('#mobile-nav-admin-content').toggle();
if ( $('.mobile-menu span.fas').hasClass('fa-times') ) {
$('.mobile-menu span.fas').toggleClass('fa-bars fa-times');
}
})
// FIND ALL MENU LINKS THAT HAS SUBMENU
// IF HAS SUBMENU DOWN ARROW IS ADDED
$('#mobile-nav-content > ul > li').each(function(){
if ( $(this).find('ul').length > 0 ) {
$(this).addClass('has-submenu');
$(this).children('a').wrap('');
$(this).append('');
$(this).find('.mobile-sub').insertAfter($(this).find('.sublinks').find('a'))
}
})
// PREVENT # JUMP
$('a[href="#"]').each(function(){
$(this).on('click', function(e) {
e.preventDefault();
});
})
// SUBMENU INITIATOR
$('a.mobile-sub').each(function(){
$(this).click(function(e){
e.preventDefault();
$(this).parent().next().toggleClass('submenu-active');
})
/*$(this).parent().click(function(e){
e.preventDefault();
$(this).next().toggleClass('submenu-active');
})*/
})
$('#mobile-nav-content ul.gf-menu > li.has-submenu > ul').click(function(){
$(this).addClass('submenu-active');
});
$('.gf-menu-container').addClass('clearfix')
// =======================================================
// TOP HEADER PREPEND ADMIN-TOGGLE
// =======================================================
$('#top-header').prepend('');
// =======================================================
// MOBILE TOGGLE CLICK
// =======================================================
$('.mobile-toggle').click(function(){
$('.gf-menu').stop().slideToggle();
})
// =======================================================
// ADMIN TOGGLE CLICK
// =======================================================
$('.admin-toggle').click(function(){
$('#top-nav').stop().slideToggle();
})
// =======================================================
// FOOTER DIVS
// =======================================================
//$('.custom-footer').insertBefore('#footer');
$('#footer div').wrapAll( "" );
// =======================================================
// CHANGE BOTTOM NAV LINKS
// =======================================================
$("#bottom-nav li:nth-child(5) a").attr('target','_blank');
// =======================================================
// CHANGE TOP NAV MY ACCOUNT, LOGIN, LOGOUT LINKS
// =======================================================
// =======================================================
// CUSTOM IDs
// =======================================================
if ( window.location.pathname.indexOf('/pages/fundraisingauthority') > -1 ) {
$('.form-wrapper').attr('id','fundraising-authority');
$('.form-wrapper').css({'text-align':'center'});
$('.align-right.medium-margin-top').removeClass('align-right');
}
if ( window.location.pathname.indexOf('/pages/edit') > -1 ) {
$('.form-wrapper').attr('id','manage-page')
}
// =======================================================
// SYSTEM GENERATED
// =======================================================
// isSystemPage at the top of this HTML
function sgOverrides(){
$('body').addClass('sg-overrides');
//$('#top-section').prependTo('#custom-header > .max');
$('#page-banner').css('display','none');
var sgNavMenu = $('ul.gf-menu-eventcreator > li.gf-item > a');
sgNavMenu.each(function(){
if ($(this).text() == 'Events'){
$(this).parent().addClass('show-this-inline');
}
if ($(this).text() == 'Home'){
$(this).parent().addClass('show-this-inline');
}
})
var sgNavMenuMobile = $('ul.gf-menu-eventcreator > li.gf-item > .sublinks > a');
sgNavMenuMobile.each(function(){
if ($(this).text() == 'Events'){
$(this).parent().parent().addClass('show-this');
}
})
};
if( isSystemPage ){
sgOverrides();
}
// =======================================================
// EMPTY DIVS
// =======================================================
$('#header .empty, .portal-container .empty').empty();
// =======================================================
// REGISTRATION FORMS - REGULAR DONATION
// =======================================================
$('.regular_donation_wrapper .ginput_container > span:nth-child(1) > label').text('Yes, I would like to make a Regular Giving Payment');
$('.regular_donation_wrapper .ginput_container > span:nth-child(2) > label').text('');
// =======================================================
// REGISTRATION FORMS - PAYMENT EXPIRT MM/YY
// =======================================================
$('.tab-braintree #fieldrowCCExpiryDate input').attr('placeholder','MM/YY');
// =======================================================
// TRANSFER SUBLABELS TO TOP
// =======================================================
$('.gform_wrapper .ginput_complex > span > label:parent').each(function () {
$(this).insertBefore($(this).prev('input, select'));
});
// =======================================================
// NAV CONTAINS SPECIFIC TEXT
// =======================================================
var el = $('li.gf-item a');
el.each(function(){
/*if ($(this).text() == 'Home'){
$(this).html('');
}*/
if ($(this).text() == 'Donate'){
$(this).addClass('button-nav');
$(this).addClass('btn');
$(this).parent().addClass('button-nav-li');
$(this).attr('role','button');
}
if ($(this).text() == 'Fundraise'){
$(this).addClass('button-nav');
$(this).addClass('btn');
$(this).parent().addClass('button-nav-li');
$(this).attr('role','button');
}
if ($(this).text() == 'Share your volunteer story'){
$(this).addClass('button-nav');
$(this).addClass('btn');
$(this).parent().addClass('button-nav-li');
$(this).attr('role','button');
}
if ($(this).text() == 'Volunteer'){
$(this).addClass('button-nav');
$(this).addClass('btn');
$(this).parent().addClass('button-nav-li');
$(this).attr('role','button');
}
})
// =======================================================
// ADD SUBMENU FOOTER LINKS
// =======================================================
$('li.add-submenu').each(function(){
$(this).hover(function(){
$(this).find('ul').stop().toggle()
})
})
$('#custom-footer li.add-submenu > a').click(function(e){
e.preventDefault();
})
});
// =======================================================
// WINDOW SCROLL
// =======================================================
// =======================================================
// WINDOW RESIZE
// =======================================================
$(window).on('resize', function(){
// ==========================================
// resize - 767 gf-menu and top-nav remove "style" attribute
// ==========================================
if ($(window).width() > 767 ) {
removeInlineStyle('.gf-menu,#top-nav');
//$('.gf-menu,#top-nav').removeAttr('style');
}
// ==========================================
// PERFORM - RETURN TO NORMAL FUNCTION
// ==========================================
returnToNormal();
// =======================================================
// CUSTOM NAV SCRIPTS - see also document ready
// =======================================================
// RESET IF RESIZED TO DESKTOP
//changed if ( $(window).width() > 943 ){
if ( $(window).width() >= 1134 ){
removeInlineStyle('#mobile-nav-admin-content');
removeInlineStyle('#mobile-nav-content');
/*$('#mobile-nav-admin-content').removeAttr('style');
$('#mobile-nav-content').removeAttr('style');*/
$('ul.submenu-active').each(function(){
$(this).removeClass('.submenu-active');
});
$('.mobile-menu span.fas').removeClass('fa-times').addClass('fa-bars');
}
})
// =======================================================
// WINDOW LOAD
// =======================================================
$(window).on('load', function(){
// =======================================================
// DESKTOP SUBMENU ARROWS
// =======================================================
$('#navigation ul.gf-submenu').each(function(){
var preWidth = $(this).prev().width();
$(this).prepend('
');
$(this).find('.arrow').css({
'left':(preWidth - 12) + 'px'
})
})
// =======================================================
// CUSTOM RSF
// =======================================================
$('#simple a:contains(" ")').each(function(){
$(this).html($(this).html().split(" ").join(""));
});
$('#simple a').each(function(){
var $this = $(this);
$this.text( '$' + parseFloat( $this.text().replace('$','').replace(',','') ).toFixed(0).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") );
})
function rsfProgressBar(wrapperId, target){
var elemId = wrapperId ? wrapperId + " " : "";
var total = parseFloat ( $(elemId + '#simple a').text().replace('$', '').replace(/,/g, '') );
var getPercentage = (total / target) * 100;
$(elemId + '.rsf-bar-progress').css({
width: getPercentage + '%'
})
}
// EXAMPLE
//rsfProgressBar('#funds-raised', 20000);
rsfProgressBar('#national-raised', 200000);
});
// OTHER SCRIPTS
function isDesktopWidth() {
var winDesktopW = $(window).width();
if( winDesktopW >= 1328 ){
return true;
} else {
return false;
}
}
// CLONE NAV BELOW CUSTOM HEADER
/*function addClone() {
$('#navigation').clone().appendTo( $('#custom-header') ).addClass('clone')
}
function removeClone() {
$('#custom-header #navigation').remove();
}
$(function(){
addClone();
$("#navigation .gf-menu > li.gf-item").each(function () {
$(this).hover(function () {
$(this).find("ul.gf-submenu").css("display", "block");
}, function(){
$(this).find("ul.gf-submenu").css("display", "none");
});
});
})*/
// Transfer logo to top if mobile
function isMobileWidth() {
var winW = $(window).width();
if( winW