function equalize_height(){ jQuery('#content').css('height', 'auto'); jQuery('#sidebar').css('height', 'auto'); var sidebar_height = jQuery('#sidebar').height(); var content_height = jQuery('#content').height(); var main_content_height = jQuery('#main-content').height(); if(jQuery('#slider-container').length){ var slider_height = jQuery('#slider-container').height() + 10; }else{ var slider_height = 0; } if(jQuery('#accordion-container').length){ var accordion_height = jQuery('#accordion-container').height() + 10; }else{ var accordion_height = 0; } if(sidebar_height > main_content_height){ jQuery('#content').height(sidebar_height - slider_height - accordion_height); }else{ jQuery('#sidebar').height(main_content_height - 60); } } jQuery(document).ready(function($){ /* --------------------------------------------------------------------------------------------------- Navigation --------------------------------------------------------------------------------------------------- */ $('ul.sf-menu').superfish({ autoArrows : false, animation : { opacity:'show' }, speed : 'fast', disableHI : true, delay : 100 }); $('#navigation ul ul').each(function(){ $(this).prepend(''); }); /* --------------------------------------------------------------------------------------------------- Slider - Make a copy of the slide info --------------------------------------------------------------------------------------------------- */ $('#slider-inner div').each(function(){ var slide_info_element = $(this).find('.slide-info'); var slide_title_element = slide_info_element.find('.slide-title'); var slide_descr_element = slide_info_element.find('.slide-description'); var slide_title = slide_title_element.html(); var slide_descr = slide_descr_element.html(); slide_info_element.append(''; }, before: function(){ $(this).addClass('current-slide').siblings('.current-slide').removeClass('current-slide'); } }); }else{ $(this).cycle({ fx: 'scrollHorz', timeout: 0, speed: 500, before: function(){ $(this).addClass('current-slide').siblings('.current-slide').removeClass('current-slide'); } }); } }); }); }); }); /* --------------------------------------------------------------------------------------------------- Elements - Flickr --------------------------------------------------------------------------------------------------- */ var flickr_profile; var flickr_amount; $('.flickr-stream').each(function(){ flickr_profile = $(this).find('input.flickr-profile').val(); flickr_amount = $(this).find('input.flickr-amount').val(); $(this).html(''); $(this).jflickrfeed({ limit: flickr_amount, qstrings: { id: flickr_profile }, itemTemplate: '
'); slide_title_element.css({ opacity : 0 }); slide_descr_element.css({ opacity : 0 }); }); /* --------------------------------------------------------------------------------------------------- Slider - Prev Action --------------------------------------------------------------------------------------------------- */ $('#slider-prev').live('click', function(e){ e.preventDefault(); if(!($('.slider-slide:animated').length)){ $('#slider-inner').cycle('prev'); } }); /* --------------------------------------------------------------------------------------------------- Slider - Next Action --------------------------------------------------------------------------------------------------- */ $('#slider-next').live('click', function(e){ e.preventDefault(); if(!($('.slider-slide:animated').length)){ $('#slider-inner').cycle('next'); } }); /* --------------------------------------------------------------------------------------------------- Slider - Hide all excerpt first one --------------------------------------------------------------------------------------------------- */ $('#slider-inner .slider-slide:first').siblings('.slider-slide').hide(); /* --------------------------------------------------------------------------------------------------- Slider Carousel - Hover Animation --------------------------------------------------------------------------------------------------- */ $('.slide-images').mouseenter(function(){ var margin_animate_size = ($(this).height() / 2) - 19; var portfolio_overlay = $(this).find('.slide-overlay'); var portfolio_overlay_inner = $(this).find('.slide-overlay-inner'); var animate_size = 37; var animate_size_rounded = 18; portfolio_overlay_inner.stop(); portfolio_overlay.stop().animate({ opacity : 1 }, 150, function(){ portfolio_overlay_inner.animate({ opacity : 1, width : animate_size, height : animate_size, width : animate_size, marginTop : margin_animate_size }, 300); }); }).mouseleave(function(){ var margin_animate_size = 0; var portfolio_overlay = $(this).find('.slide-overlay'); var portfolio_overlay_inner = $(this).find('.slide-overlay-inner'); portfolio_overlay.stop(); portfolio_overlay_inner.stop().animate({ opacity : 0, width : 10, height : 10, marginTop : margin_animate_size }, 150, function(){ portfolio_overlay.animate({ opacity : 0 }, 150); }); }); /* --------------------------------------------------------------------------------------------------- Slider Carousel - Hide all images besides the first one --------------------------------------------------------------------------------------------------- */ $('.slide-images-inner').each(function(){ $(this).find('a:first').siblings('a').hide(); }); /* --------------------------------------------------------------------------------------------------- Slider Carousel Listing Frames - Click (Lightbox) --------------------------------------------------------------------------------------------------- */ $('.slide-images').live('click', function(){ $(this).find('.slide-images-inner .current-slide').click(); }); /* --------------------------------------------------------------------------------------------------- Elements - Tabs --------------------------------------------------------------------------------------------------- */ $('.tabs-container .tab-content:first-child').siblings('.tab-content').hide(); $('.tabs-nav li:first-child').addClass('active'); $('.tabs-container .tabs-nav a').live('click', function(e){ e.preventDefault(); $(this).parents('li').addClass('active').siblings('li.active').removeClass('active'); var tab_id = $(this).parents('li').index(); $(this).parents('.tabs-container').find('.tab-content').eq(tab_id).show().siblings('.tab-content').hide(); }); /* --------------------------------------------------------------------------------------------------- Elements - Widget Navigation - Animation --------------------------------------------------------------------------------------------------- */ $('.widget_nav_menu ul li a').mouseenter(function(){ $(this).stop().animate({ paddingLeft : 10 }, 200); }).mouseleave(function(){ $(this).stop().animate({ paddingLeft : 0 }, 200); }); /* --------------------------------------------------------------------------------------------------- Elements - Blog Hover Animation --------------------------------------------------------------------------------------------------- */ $('.blog-images-inner, .portfolio-images-inner').mouseenter(function(){ $(this).stop().animate({ opacity : 0.8 }, 200); }).mouseleave(function(){ $(this).stop().animate({ opacity : 1 }, 200); }); /* --------------------------------------------------------------------------------------------------- Elements - Twitter --------------------------------------------------------------------------------------------------- */ var twitter_profile; var twitter_amount; $('.recent-tweets').each(function(){ twitter_profile = $(this).find('input.twitter-profile').val(); twitter_amount = $(this).find('input.twitter-amount').val(); $(this).tweet({ username: twitter_profile, join_text: 'auto', avatar_size: 32, count: twitter_amount, auto_join_text_default: '', auto_join_text_ed: '', auto_join_text_ing: '', auto_join_text_reply: '', auto_join_text_url: '', loading_text: 'Loading tweets...', template: '{time}{join}{text}' }).bind('loaded', function(){ equalize_height(); }); }); /* --------------------------------------------------------------------------------------------------- Elements - Content Box - Toggle --------------------------------------------------------------------------------------------------- */ $('.content-box-toggle').each(function(){ var content_box = $(this).parents('.content-box'); var content_box_content = content_box.find('.content-box-content'); content_box_content.height(content_box_content.outerHeight()); if(content_box.hasClass('content-box-toggle-state-closed')){ content_box.find('.content-box-content').hide(); }else{ content_box.addClass('content-box-toggle-state-open'); } }); $('.content-box-toggle-state-open .content-box-toggle, .content-box-toggle-state-open .content-box-title').live('click', function(e){ e.preventDefault(); var content_box = $(this).parents('.content-box'); content_box.find('.content-box-content').slideUp(200); content_box.removeClass('content-box-toggle-state-open').addClass('content-box-toggle-state-closed'); }); $('.content-box-toggle-state-closed .content-box-toggle, .content-box-toggle-state-closed .content-box-title').live('click', function(e){ e.preventDefault(); var content_box = $(this).parents('.content-box'); content_box.find('.content-box-content').slideDown(200); if($(this).parents('.accordion').length){ content_box.siblings('.content-box.content-box-toggle-state-open').find('.content-box-toggle').click(); } content_box.removeClass('content-box-toggle-state-closed').addClass('content-box-toggle-state-open'); }); /* --------------------------------------------------------------------------------------------------- Elements - Testimonials --------------------------------------------------------------------------------------------------- */ if($('.testimonials-scroller li').length){ $('.testimonials-scroller').each(function(){ var testimonials_delay = $(this).parents('.testimonials-scroller-container').find('.testimonials-delay').val(); $(this).cycle({ fx: 'fade', timeout: testimonials_delay, speed: 500 }); }); } /* --------------------------------------------------------------------------------------------------- Elements - Lightbox --------------------------------------------------------------------------------------------------- */ $('a[rel^="prettyPhoto"]').prettyPhoto({ social_tools : '' }); /* --------------------------------------------------------------------------------------------------- Portfolio Listing Regular - Hover Animation --------------------------------------------------------------------------------------------------- */ $('.portfolio-listing-regular .portfolio-images:has(.portfolio-overlay)').live('mouseenter', function(){ if(jQuery(this).closest('ul').not(':animated').length){ var margin_animate_size = ($(this).height() / 2) - 19; var portfolio_overlay = $(this).find('.portfolio-overlay'); var portfolio_overlay_inner = $(this).find('.portfolio-overlay-inner'); var animate_size = 37; var animate_size_rounded = 18; portfolio_overlay_inner.stop(); portfolio_overlay.stop().animate({ opacity : 1 }, 150, function(){ portfolio_overlay_inner.animate({ opacity : 1, width : animate_size, height : animate_size, width : animate_size, marginTop : margin_animate_size }, 300); }); } }).live('mouseleave', function(){ if(jQuery(this).closest('ul').not(':animated').length){ var margin_animate_size = 0; var portfolio_overlay = $(this).find('.portfolio-overlay'); var portfolio_overlay_inner = $(this).find('.portfolio-overlay-inner'); portfolio_overlay.stop(); portfolio_overlay_inner.stop().animate({ opacity : 0, width : 10, height : 10, marginTop : margin_animate_size }, 150, function(){ portfolio_overlay.animate({ opacity : 0 }, 150); }); } }); /* --------------------------------------------------------------------------------------------------- Portfolio - Hide all images besides the first one --------------------------------------------------------------------------------------------------- */ $('.portfolio-images-inner').each(function(){ $(this).find('a:first').siblings('a').hide(); }); /* --------------------------------------------------------------------------------------------------- Portfolio Listing Frames - Click (Lightbox) --------------------------------------------------------------------------------------------------- */ $('.portfolio-listing-regular .portfolio-images').live('click', function(){ $(this).find('.portfolio-images-inner .current-slide').click(); }); /* --------------------------------------------------------------------------------------------------- Portfolio Listing - Hide all images except first --------------------------------------------------------------------------------------------------- */ $('.portfolio-image-inner img:first-child').show().siblings('img').hide(); /* --------------------------------------------------------------------------------------------------- Contact Form --------------------------------------------------------------------------------------------------- */ $('.contact-form form').submit(function(e){ e.preventDefault(); var submit_path = $(this).attr('action'); var name = $(this).find('.contact-form-name'); var email = $(this).find('.contact-form-email'); var message = $(this).find('.contact-form-message'); var status = true; name.removeClass('contact-form-invalid'); email.removeClass('contact-form-invalid'); message.removeClass('contact-form-invalid'); if(name.val() == ''){ name.addClass('contact-form-invalid'); status = false; } if(email.val() == ''){ email.addClass('contact-form-invalid'); status = false; } if(message.val() == ''){ message.addClass('contact-form-invalid'); status = false; } if(status == true){ $(this).parents('.contact-form').load(submit_path, $(this).serialize()); } }); /* -------------------------------------------------- Portfolio Listing - Filter - Quicksand -------------------------------------------------- */ $('#portfolio-filter a').click(function(e){ e.preventDefault(); $('#portfolio-filter .black').removeClass('black'); $(this).addClass('black'); $.get( $(this).attr('href'), function(data) { $('.portfolio-quicksand').quicksand( $(data).find('li'), { adjustHeight: 'dynamic' }, function(){ /* Set the offset */ $('.portfolio-listing-regular').each(function(){ var portfolio_image_width = $(this).find('img').width(); var portfolio_image_height = $(this).find('img').height(); $(this).find('.portfolio-info').css({ left : portfolio_image_width, width : portfolio_image_width }); var portfolio_info_height; var portfolio_info_offset; $(this).find('.portfolio-info').each(function(){ portfolio_info_height = $(this).outerHeight(); portfolio_info_offset = (portfolio_image_height / 2) - (portfolio_info_height / 2); $(this).css({ top : portfolio_info_offset }); }); }); /* Hide all images excerpt first */ $('.portfolio-images-inner').each(function(){ $(this).find('a:first').siblings('a').hide(); }); /* Init lightbox */ $('.portfolio-quicksand a[rel^="prettyPhoto"]').prettyPhoto({ social_tools : '' }); $('.portfolio-images-inner').each(function(){ var portfolio_images_nav = jQuery(this).parents('li').find('.portfolio-images-nav'); if($(this).find('a').length > 1){ $(this).cycle({ fx: 'scrollHorz', timeout: 0, speed: 500, pager: portfolio_images_nav, pagerAnchorBuilder: function(idx, slide) { return '