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('' + slide_title + '' + slide_descr + ''); 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 ''; }, 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: '
  • ' + '{{title}}' + '
  • ' },function(data) { $(this).find('a').prettyPhoto({ social_tools : '' }); $('.flickr-stream-item').mouseenter(function(){ $(this).siblings('.flickr-stream-item').stop().animate({ opacity : 0.6 }, 500); }).mouseleave(function(){ $(this).siblings('.flickr-stream-item').stop().animate({ opacity : 1 }, 500); }); }); }); }); jQuery(window).load(function(){ /* --------------------------------------------------------------------------------------------------- Slider - Before Slide --------------------------------------------------------------------------------------------------- */ function slider_before(curr, next, opts, fwd) { var index = opts.currSlide; jQuery(this).find('.slide-title-copy').addClass('current-copy').animate({ top : 15 }, 500); jQuery(this).find('.slide-description-copy').addClass('current-copy').animate({ bottom : 15 }, 500); jQuery('.slide-title-copy:not(.current-copy)').animate({ top : -100 }, 500); jQuery('.slide-description-copy:not(.current-copy)').animate({ bottom : -100 }, 500); jQuery('.current-copy').removeClass('current-copy'); } /* --------------------------------------------------------------------------------------------------- Slider - Init --------------------------------------------------------------------------------------------------- */ if(jQuery('#slider #slider-inner .slider-slide').length){ jQuery('#slider-loader').fadeOut(500, function(){ if(jQuery('#slider #slider-inner .slider-slide').length < 2){ jQuery('#slider-nav').hide(); } jQuery('#slider-container').slideDown(300, function(){ equalize_height(); }); /* If only 1 slide hide the arrows */ if(jQuery('#slider #slider-inner .slider-slide').length < 2){ jQuery('#slider-next, #slider-prev').hide(); } /* Set vars */ var slider_autoplay = parseInt($('#top-slider-autoplay-speed').val()); var slider_infinite = $('#top-slider-infinite').val(); var nowrap_var = 1; if(slider_infinite == 'circular'){ nowrap_var = 0; } /* Init slider */ jQuery('#slider #slider-inner').cycle({ fx: 'scrollHorz', timeout: slider_autoplay, speed: 500, before: slider_before, pager: $('#slider-nav'), pagerAnchorBuilder: function(idx, slide) { return ''; }, nowrap: nowrap_var }); }); } /* --------------------------------------------------------------------------------------------------- Slider Carousel - Init --------------------------------------------------------------------------------------------------- */ if(jQuery('#slider-carousel #slider-inner li').length){ var slider_autoplay = parseInt($('#top-slider-autoplay-speed').val()) / 1000; var slider_infinite = $('#top-slider-infinite').val(); jQuery('#slider-loader').fadeOut(500, function(){ jQuery('#slider-container').fadeIn(300, function(){ equalize_height(); var tallest = 0; jQuery('#slider-carousel li').each(function(){ if(jQuery(this).height() > tallest){ tallest = jQuery(this).height(); } }); jQuery('#slider-carousel li').height(tallest); }); jQuery('#slider-carousel #slider-inner').jcarousel({ itemFallbackDimension : 100, wrap : slider_infinite, auto : slider_autoplay }); /* --------------------------------------------------------------------------------------------------- Slider Carousel - Images Cycle Init --------------------------------------------------------------------------------------------------- */ jQuery('#slider-carousel .slide-images-inner').each(function(){ var portfolio_images_nav = jQuery(this).parents('li').find('.slide-images-nav'); jQuery('#slider-carousel').fadeIn(500); jQuery(this).cycle({ fx: 'scrollHorz', timeout: 0, speed: 500, pager: portfolio_images_nav, pagerAnchorBuilder: function(idx, slide) { return ''; }, before: function(){ jQuery(this).addClass('current-slide').siblings('.current-slide').removeClass('current-slide'); } }); if(jQuery(this).find('img').length < 2){ jQuery(this).closest('li').find('.slide-images-nav').remove(); } }); }); } jQuery('#slider-carousel #slider-prev').live('click', function(e){ e.preventDefault(); jQuery('#slider-carousel .jcarousel-prev').click(); }); jQuery('#slider-carousel #slider-next').live('click', function(e){ e.preventDefault(); jQuery('#slider-carousel .jcarousel-next').click(); }); /* --------------------------------------------------------------------------------------------------- Accordion --------------------------------------------------------------------------------------------------- */ if(jQuery('#accordion').length){ var accordion_width = jQuery('#accordion').width(); var accordion_spacing = 0; var accordion_item_amount = jQuery('#accordion-inner li').length; var accordion_item_width = accordion_width / accordion_item_amount - (accordion_spacing - (accordion_spacing / accordion_item_amount)); jQuery('#accordion-inner li').css({ 'width' : accordion_item_width }); jQuery('#accordion-inner').kwicks({ max : 650, spacing : accordion_spacing }); jQuery('#slider-loader').fadeOut(400, function(){ jQuery('#accordion-inner').fadeIn(400, function(){ equalize_height(); }); var accordion_height = jQuery('#accordion-inner img').height(); jQuery('#accordion-inner').height(accordion_height); var accordion_img_width = jQuery('#accordion-inner li img').width(); }); jQuery('#accordion-inner li').mouseenter(function(){ jQuery(this).find('.slide-info').stop().animate({ opacity : 1 }, 500); }).mouseleave(function(){ jQuery(this).find('.slide-info').stop().animate({ opacity : 0 }, 500); }); jQuery('#accordion-inner .slide-info').width(590); jQuery('#accordion li').mouseenter(function(){ jQuery(this).find('.accordion-shadow').stop().animate({ opacity : 0 }); }).mouseleave(function(){ jQuery(this).find('.accordion-shadow').stop().animate({ opacity : 1 }); }); } /* --------------------------------------------------------------------------------------------------- Portfolio Listing - Init Slider --------------------------------------------------------------------------------------------------- */ jQuery('.portfolio-listing-regular .portfolio-images-inner').each(function(){ var portfolio_images_nav = jQuery(this).parents('li').find('.portfolio-images-nav'); jQuery(this).cycle({ fx: 'scrollHorz', timeout: 0, speed: 500, pager: portfolio_images_nav, pagerAnchorBuilder: function(idx, slide) { return ''; }, before: function(){ jQuery(this).addClass('current-slide').siblings('.current-slide').removeClass('current-slide'); } }); if(portfolio_images_nav.find('a').length < 2){ portfolio_images_nav.hide(); } }); /* --------------------------------------------------------------------------------------------------- Portfolio Listing Fancy - Hover effect --------------------------------------------------------------------------------------------------- */ jQuery('.portfolio-listing-fancy li').live('mouseenter', function(){ if(jQuery(this).closest('ul').not(':animated').length){ jQuery(this).find('.portfolio-info').stop().animate({ opacity : 1 }, 200); jQuery(this).siblings('li').stop().animate({ opacity : 0.6 }, 200); } }).live('mouseleave', function(){ if(jQuery(this).closest('ul').not(':animated').length){ jQuery(this).find('.portfolio-info').stop().animate({ opacity : 0 }, 200); jQuery(this).siblings('li').stop().animate({ opacity : 1 }, 200); } }); /* --------------------------------------------------------------------------------------------------- Slider Posts Widget --------------------------------------------------------------------------------------------------- */ jQuery('.slider-posts-widget-container').each(function(){ jQuery(this).show(); var slider_posts_widget_speed = parseInt(jQuery(this).parents('.jw-slider-posts-widget').find('input.slider-posts-widget-speed').val()); jQuery(this).find('ul').cycle({ fx: 'fade', timeout: slider_posts_widget_speed, speed: 300, pause: 1, after: function(){ var real_height = jQuery(this).parents('.slider-posts-widget-container').height(); jQuery(this).height(real_height); var portfolio_images_nav = jQuery(this).find('.slide-images-nav'); portfolio_images_nav.html(''); jQuery(this).find('.slide-images-inner').cycle({ fx: 'scrollHorz', timeout: 0, speed: 500, pager: portfolio_images_nav, pagerAnchorBuilder: function(idx, slide) { return ''; }, before: function(){ jQuery(this).addClass('current-slide').siblings('.current-slide').removeClass('current-slide'); } }); } }); }); jQuery('.slider-posts-prev').live('click', function(e){ e.preventDefault(); jQuery(this).parents('.jw-slider-posts-widget').find('.slider-posts-widget-container').find('ul').cycle('prev'); }); jQuery('.slider-posts-next').live('click', function(e){ e.preventDefault(); jQuery(this).parents('.jw-slider-posts-widget').find('.slider-posts-widget-container').find('ul').cycle('next'); }); /* --------------------------------------------------------------------------------------------------- Slider Posts Widget - Images inner cycle init --------------------------------------------------------------------------------------------------- */ jQuery('.slider-posts-widget-container .slide-images-inner').each(function(){ var slide_images_nav = jQuery(this).parents('li').find('.slide-images-nav'); slide_images_nav.html(''); if($(this).find('a').length > 1){ jQuery(this).cycle({ fx: 'scrollHorz', timeout: 0, speed: 500, pager: slide_images_nav, pagerAnchorBuilder: function(idx, slide) { return ''; }, before: function(){ jQuery(this).addClass('current-slide').siblings('.current-slide').removeClass('current-slide'); } }); }else{ jQuery(this).cycle({ fx: 'scrollHorz', timeout: 0, speed: 500, before: function(){ jQuery(this).addClass('current-slide').siblings('.current-slide').removeClass('current-slide'); } }); } }); if(jQuery('#slider-container').length || jQuery('#accordion').length){ }else{ equalize_height(); } });