/* Theme Blossom - Custom scripts */ jQuery(document).ready(function($) { $("#navigation ul.navigation > li:last").addClass("last"); $("#navigation ul.navigation ul > li:first-child").addClass("first"); $("#navigation ul.navigation ul > li:last-child").addClass("last"); dropdownMenu(); // blockquote $('blockquote, #sidebar .quote').each(function() {$(this).find('p').eq(0).addClass('first');}); $('blockquote, #sidebar .quote').append(''); // noBorder, noPadding, noMargin divs $('#videos .wide:last').addClass('noborder'); $('#news .wide:last').addClass('noborder'); $('#galleryThumbs .thumbHolder:nth-child(3n), #gallery.eventGallery .thumbHolder:nth-child(3n)').addClass('last'); $('#videos .thumb:nth-child(4n+4)').addClass('last'); $('#videos .horDashed:last, #contactExtra ul li:last').addClass('noborder'); $('ul.noliststyle').each(function() { $(this).children('li:last').addClass('last'); });; $('#main .evenHolder:last').addClass('last'); $('#inner.woocommerce .woocommerce_tabs ul.tabs li:last').addClass('last'); $('#inner.woocommerce .woocommerce_tabs .panel tr:even').addClass('even'); $('.cart_totals table tr:even').addClass('even'); $('#sidebar .horShadow:last').addClass('nodisplay'); // full height header if ($('#header').hasClass('fullHeight')) { var windowHeight = $(window).height(); if (windowHeight > 680) { $('html').css({height: '100%'}); $('body').css({height: '100%'}); $('#header').css({height: '100%'}); } else { $('#header').css({height: 680}); } logoBigMargin = parseInt((windowHeight - 450)/2); if (logoBigMargin < 50) { logoBigMargin = 50; } $('#logoBig').css({marginTop: logoBigMargin}); }; $('#content .wp-caption, #sidebar .box').each(function() { $(this).wrapInner('
'); }); $('#sidebar .button').removeClass('button').addClass('tinyButton').addClass('roundButton'); // FAQ $('.faq div, .faq2 div').hide(); $('.faq h4').click(function() { if ($(this).parent().hasClass('inactive')) { $(this).parent().removeClass('inactive').addClass('active'); $(this).siblings('div').slideDown('slow'); } else { $(this).parent().removeClass('active').addClass('inactive'); $(this).siblings('div').slideUp('slow'); } }); $('.faq2 h4').click(function() { if ($(this).parent().hasClass('inactive')) { $(this).parent().removeClass('inactive').addClass('active'); $(this).siblings('div').slideDown('slow'); $(this).parent().siblings().removeClass('active').addClass('inactive').children('div').slideUp('normal'); } else { $(this).parent().removeClass('active').addClass('inactive'); $(this).siblings('div').slideUp('slow'); } }); // Heights and widths $('.issuesThumbs').each(function() { var minHeight = 0; $(this).children('.issuesThumb').each(function() { if ($(this).height() > minHeight) { minHeight = $(this).innerHeight(); } }); minHeight = minHeight + 22; $(this).children('.issuesThumb').css({'height': minHeight}); }); $('#news .row').each(function() { var minHeight = 0; $(this).children('.news').each(function() { if ($(this).height() > minHeight) { minHeight = $(this).innerHeight(); } }); //web.archive.orghttp://minHeight/ = minHeight + 22; $(this).children('.news').css({'height': minHeight}); }); // effects for non-IE browsers if ( $.browser.msie != true ) { $('#logo, ul.footerSoc li a').hover(function() { $(this).animate({opacity: 0.75}, 600); }, function() { $(this).animate({opacity: 1}, 600); }); $('#campaignSlides .slides_container .slide a').hover(function() { $(this).siblings('img').animate({opacity: 0.75}, 600); }, function() { $(this).siblings('img').animate({opacity: 1}, 600); }); } }); // Login Form $(document).ready(function($) { $("#topNav a.login").click(function() { if ($(this).hasClass('active')) { $(this).removeClass('active').addClass('inactive'); $("#loginForm").fadeOut().removeClass('active'); } else { $(this).addClass('active').removeClass('inactive'); $("#loginForm").fadeIn().addClass('active'); } }); }); /* ADD SPECIAL CLASSES */ $(document).ready(function($) { $('#footer .grid_3 .photos:last').addClass('nopadding nobckg'); }); /* SlideJS */ $(document).ready(function($) { $("#home #slider").slides({ effect: 'fade', generateNextPrev: false, generatePagination: true, paginationClass: 'slider_pagination', fadeSpeed: 800, play: 5000 }); $("#gallery #slider").slides({ effect: 'slide', generateNextPrev: false, generatePagination: true, paginationClass: 'slider_pagination', slideSpeed: 800, slideEasing: "easeOutBounce", play: 5000 }); $("#sidebarGallery").slides({ effect: 'slide', generateNextPrev: true, generatePagination: false, slideSpeed: 800, play: 5000 }); $("#campaignSlides").slides({ effect: 'fade', generateNextPrev: true, generatePagination: false, fadeSpeed: 250, play: 5000 }); }); /* SMOOTH SCROLLING */ jQuery(document).ready(function($) { $('.scroll').bind('click',function(event){ var $anchor = $(this); $('html, body').stop().animate({ scrollTop: $($anchor.attr('href')).offset().top }, 1000); event.preventDefault(); }); }); /* PRETTY PHOTO, DOUBLE FRAMED THUMBNAILS, GALLERY PAGE */ $(document).ready(function() { $(".doubleFramed a, #campaignSlides .slides_container .slide, #shopWidget > a, ul.noliststyle .thumb, .flickr_badge_image a").append(''); $('a[href$=jpg], a[href$=png], a[href$=gif], a[href$=jpeg], .singleItem .thumb a').each(function() { if(!$(this).attr('rel') != undefined && !$(this).attr('rel') != '') { $(this).attr('rel', 'prettyPhoto'); } var width = $(this).children('img').width(); var height = $(this).children('img').height(); $(this).css({'display': 'block', 'width': width, 'height': height}); $(this).append(''); }); $('a[href$=".mov"] , a[href$=".swf"] , a[href*="vimeo.com"] , a[href*="youtube.com"]').each(function() { if(!$(this).attr('rel') != undefined && !$(this).attr('rel') != '') { $(this).attr('rel', 'prettyPhoto'); } $(this).append(''); }); $('#gallery .thumbHolder .thumb a').each(function() { if ($(this).attr('rel') == 'prettyPhoto') { $(this).attr('rel', 'prettyPhoto[gallery]'); } }); $('#sidebarGallery .slides_container ').each(function() { if ($(this).attr('rel') == 'prettyPhoto') { $(this).attr('rel', 'prettyPhoto[sidebarGallery]'); } }); $('#gallery #slider a').each(function() { if ($(this).attr('rel') == 'prettyPhoto') { $(this).attr('rel', 'prettyPhoto[slider]'); } }); $("a[rel^='prettyPhoto'], .doubleFramed a, #shopWidget > a, ul.noliststyle .thumb, .flickrWidget a, #inner.woocommerce .wooImage a").hover(function() { $(this).children('img').animate({opacity: 0.5}, 400); }, function() { $(this).children('img').animate({opacity: 1}, 400); }); $("#sidebarGallery a").hover(function() { $(this).children('img').animate({opacity: 0.5}, 400); var captionHeight = (-1) * $(this).children('span.imageCaption').outerHeight(); $(this).children('span.imageCaption').animate({bottom: captionHeight}, 400); }, function() { $(this).children('img').animate({opacity: 1}, 400); $(this).children('span.imageCaption').animate({bottom: 0}, 400); }); $("a[rel^='prettyPhoto']").prettyPhoto({ animation_speed: 'normal', slideshow: 4000, autoplay_slideshow: false, theme: 'facebook' }); $('#videos .wide, #home .video').each(function() { $(this).children('div:first').addClass('player'); }); $('#home #slider .slide').each(function () { $(this).append(''); }); $('#home #slider .slide a').hover(function() { $(this).siblings('img').animate({opacity: 0.5}, 400); }, function() { $(this).siblings('img').animate({opacity: 1}, 400); }); $('.eventFrame a').hover(function() { $(this).siblings('span.image').animate({opacity: 0.5}, 400); $(this).siblings('div').animate({bottom: -28}, 400); }, function() { $(this).siblings('span.image').animate({opacity: 1}, 400); $(this).siblings('div').animate({bottom: 0}, 400); }); }); /* DROPDOWN */ function dropdownMenu() { $("ul.navigation ul ").css({display: "none"}); $("ul.navigation li").each(function() { var $dropdownMenu = $(this).find('ul:first'); $(this).hover(function() { $dropdownMenu.stop().css({overflow:"hidden", height:"auto", display:"none"}).slideDown(400, function() { $(this).css({overflow:"visible", height:"auto"}); }); }, function() { $dropdownMenu.stop().slideUp(400, function() { $(this).css({overflow:"hidden", display:"none"}); }); }); }); } /* CONTACT FORMS */ /* validate email */ function isValidEmail(email){ var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i); return pattern.test(email); } jQuery(document).ready(function() { /* Subscribe Form */ $('form#newsletterForm').submit(function() { var sendingError = false; var tbSenderEmail = $("form#newsletterForm input#email").val(); if (jQuery.trim(tbSenderEmail) == "" || jQuery.trim(tbSenderEmail) == "Type in Your Email Address..." || !isValidEmail(tbSenderEmail)) { $(this).parent().addClass('sendingError'); $(this).children('span').fadeIn(1500).fadeOut(1500); $(this).children('#email').focus(); sendingError = true; } else {/* $(this).parent('div.formHolder').removeClass('sendingError').fadeOut(900); $(this).parent().siblings('div').delay(900).fadeIn(900);*/ } if (!sendingError) { $.post($("#newsletterForm").attr('action'), $("#newsletterForm").serialize(), function(data) { $("#landing .formHolder").removeClass('sendingError').fadeOut(900); $('#signUpSuccess').html(data).delay(900).fadeIn(900); }); } return false; }); // Contact Form $('form#contactForm').submit(function() { var sendingError = false; var tbSenderEmail = $("form#contactForm input#email").val(); var tbMessage = $("form#contactForm textarea#message").val(); if (jQuery.trim(tbSenderEmail) == "" || jQuery.trim(tbSenderEmail) == "Your Email Address..." || !isValidEmail(tbSenderEmail)) { $(this).children('p').children('#email').siblings().fadeIn(1500).fadeOut(1500); $(this).children('p').children('#email').focus(); sendingError = true; } if (jQuery.trim(tbMessage) == "" || jQuery.trim(tbMessage) == "Your Message...") { $(this).children('p').children('#message').siblings().fadeIn(1500).fadeOut(1500); sendingError = true; } if (!sendingError) { $('#contactForm .buttons input').fadeOut('normal', function(){ $('form#contactForm .ajaxLoader').fadeIn('fast'); }); $.post($("#contactForm").attr('action'), $("#contactForm").serialize(), function(data){ $('#contactFormResult').html(data); $('form#contactForm .ajaxLoader').remove(); $('#contactForm').fadeOut('slow'); $('#contactForm').next('div').fadeOut('slow'); }); } return false; }); }); /* Woo Commerce Plugin */ $(document).ready(function() { $('#tbWooCommerce form#getInvolvedForm input').click(function() { var pid = $(this).val(); var permalink = $('form#getInvolvedForm input[type=hidden]').val(); var action = permalink + '?add-to-cart=' + pid; $('form#getInvolvedForm').attr('action', action); }); $('.wooImage > .mainImage > img').addClass('hasNoLink'); $('#inner.woocommerce .button, #tbWooCommerce .button').removeClass('button').addClass('tinyButton').addClass('roundButton').addClass('right'); $('p.buttons').children('.button').addClass('roundButton'); $('ul.products li').each(function() { $(this).children('a:first').addClass('wooImageLink'); }); $('ul.products li a.wooImageLink img').after(''); $('ul.products li a.wooImageLink').hover(function() { $(this).children('img').animate({opacity: 0.6}, 400); }, function() { $(this).children('img').animate({opacity: 1}, 400); }); }); // Easy WordPress Donations $(document).ready(function() { $('form.ewd_form').removeClass('ewd_form').attr('id', 'getInvolvedForm').addClass('ewd_form'); $('form.ewd_form input[type=submit]').addClass('bigButton').addClass('roundButtonX'); $('form.ewd_form input[type=text], form.ewd_form textarea, form.ewd_form .selector').after('
'); $('form.ewd_form input[type=text], form.ewd_form textarea, form.ewd_form .selector').prev().addClass('beforeText'); $('form.ewd_form label').next('br').remove(); });