jQuery(document).ready(function( $ ) { // Call fitVid before FlexSlider initializes, so the proper initial height can be retrieved. $(".flexslider") .fitVids() .flexslider({ animation: "slide", slideshowSpeed: 4000, animationDuration: 500, directionNav: true, controlNav: true, keyboardNav: true, useCSS: false, animationLoop: true, smoothHeight: true, }); /*-----------------------------------------------------------------------------------*/ /* Social Icons /*-----------------------------------------------------------------------------------*/ $('#facebook, #twitter, #flickr, #vimeo, #youtube, #linkedin, #googleplus, #dribbble, #tumblr, #skype, #delicious, #digg, #rss, #soundcloud, #forrst').append('').each(function () { var $span = $('> span.hover', this).css('opacity', 0); $(this).hover(function () { $span.stop().fadeTo(500, 1); }, function () { $span.stop().fadeTo(500, 0); }); }); /*-----------------------------------------------------------------------------------*/ /* Drop-down Page /*-----------------------------------------------------------------------------------*/ var $dropDownWrapper = $( '#dropdown-wrapper' ); if ( $dropDownWrapper.length ) { $('#dropdown-trigger').click(function() { var pageHeight = $('.dropdown-page').height() + 60; // Get the height, while including the top and bottom padding of the drop-down page var wrapperHeight = $dropDownWrapper.height(); // Animate the height of the wrapper, depending on the current state (visible or not) if( wrapperHeight == 0 ) { $('.drop-down-arrows').css('backgroundPosition', 'left top'); $dropDownWrapper.animate( { height: pageHeight }, 700, 'easeOutCubic', function() { $(this).css('height', 'auto'); }); } else { $('.drop-down-arrows').css('backgroundPosition', '0px -11px'); $dropDownWrapper.animate( { height: 0 }, 500, 'easeOutCubic' ); } $( 'body, html' ).animate({ scrollTop: 0 }, 200, 'easeOutCubic' ); }); } /*-----------------------------------------------------------------------------------*/ /* Dynamic To Top /*-----------------------------------------------------------------------------------*/ var mv_dynamic_to_top = {"text":"To Top","version":"0","min":"300","speed":"1100","easing":"easeInExpo","margin":"20"}; var mv_dynamic_to_top; (function ($, mv_dynamic_to_top) { jQuery.fn.DynamicToTop = function (options) { var defaults = { text: mv_dynamic_to_top.text, min: parseInt(mv_dynamic_to_top.min, 10), fade_in: 600, fade_out: 400, speed: parseInt(mv_dynamic_to_top.speed, 10), easing: mv_dynamic_to_top.easing, version: mv_dynamic_to_top.version, id: 'dynamic-to-top' }, settings = $.extend(defaults, options); if (settings.version === "" || settings.version === '0') { settings.text = ' '; } if ( ! $.isFunction(settings.easing) ) { settings.easing = 'linear'; } var $toTop = $('').html(settings.text); $toTop.hide().appendTo('body').click(function () { $('html, body').stop().animate({ scrollTop: 0 }, settings.speed, settings.easing); return false; }); $(window).scroll(function () { var sd = jQuery(window).scrollTop(); if (typeof document.body.style.maxHeight === "undefined") { $toTop.css({ 'position': 'absolute', 'top': sd + $(window).height() - mv_dynamic_to_top.margin }); } if (sd > settings.min) { $toTop.fadeIn(settings.fade_in); } else { $toTop.fadeOut(settings.fade_out); } }); }; $('body').DynamicToTop(); })(jQuery, mv_dynamic_to_top); /*-----------------------------------------------------------------------------------*/ /* BACKGROUND FIX /*-----------------------------------------------------------------------------------*/ var theWindow = jQuery(window), $bg = jQuery("#full_background"), aspectRatio = $bg.width() / $bg.height(); function resizeBg() { if ( (theWindow.width() / theWindow.height()) < aspectRatio ) { $bg .removeClass() .addClass('bgheight'); } else { $bg .removeClass() .addClass('bgwidth'); } } theWindow.resize(function() { resizeBg(); }).trigger("resize"); /*-----------------------------------------------------------------------------------*/ /* ISOTOPE ACTIVATION /*-----------------------------------------------------------------------------------*/ var $container = $('#container'); $container.imagesLoaded( function(){ $container.isotope({ itemSelector : '.element', }); }); var $container = $('#container'); $container.isotope({ itemSelector : '.element', // disable resizing // set columnWidth to a percentage of container width masonry: { columnWidth: $container.width() / 4 }, getSortData : { symbol : function( $elem ) { return $elem.attr('data-symbol'); }, category : function( $elem ) { return $elem.attr('data-category'); }, number : function( $elem ) { return parseInt( $elem.find('.number').text(), 10 ); }, weight : function( $elem ) { return parseFloat( $elem.find('.weight').text().replace( /[\(\)]/g, '') ); }, name : function ( $elem ) { return $elem.find('.name').text(); } } }); // update columnWidth on window resize $(window).smartresize(function(){ $container.isotope({ // set columnWidth to a percentage of container width masonry: { columnWidth: $container.width() / 4 } }); }); var $optionSets = $('#options .option-set'), $optionLinks = $optionSets.find('a'); $optionLinks.click(function(){ var $this = $(this); // don't proceed if already selected if ( $this.hasClass('selected') ) { return false; } var $optionSet = $this.parents('.option-set'); $optionSet.find('.selected').removeClass('selected'); $this.addClass('selected'); // make option object dynamically, i.e. { filter: '.my-filter-class' } var options = {}, key = $optionSet.attr('data-option-key'), value = $this.attr('data-option-value'); // parse 'false' as false boolean value = value === 'false' ? false : value; options[ key ] = value; if ( key === 'layoutMode' && typeof changeLayoutMode === 'function' ) { // changes in layout modes need extra logic changeLayoutMode( $this, options ) } else { // otherwise, apply new options $container.isotope( options ); } return false; }); // toggle variable sizes of all elements $('#toggle-sizes').find('a').click(function(){ $container .toggleClass('variable-sizes') .isotope('reLayout'); return false; }); var $sortBy = $('#sort-by'); $('#shuffle a').click(function(){ $container.isotope('shuffle'); $sortBy.find('.selected').removeClass('selected'); $sortBy.find('[data-option-value="random"]').addClass('selected'); return false; }); /*-----------------------------------------------------------------------------------*/ /* Search Movement /*-----------------------------------------------------------------------------------*/ // Search Movement jQuery(".search-wrapper").filter(":first").find("#searchsubmit").click(function(){ if( jQuery(this).siblings("#search-text").width() == 1 ){ jQuery(this).siblings("#search-text").children("input[type='text']").val(''); jQuery(this).siblings("#search-text").animate({ width: '170px' }); jQuery(this).siblings("#search-text").children("input[type='text']").focus(); return false; } if( jQuery(this).siblings("#search-text").children("input[type='text']").val() == '' ){ return false; } }); jQuery("#searchform").click(function(){ if (event.stopPropagation){ event.stopPropagation(); } else if(window.event){ window.event.cancelBubble=true; } //event.stopPropagation(); }); jQuery("html").click(function(){ jQuery(this).find(".search-wrapper").filter(":first").find("#search-text").animate({ width: '1px' }); }); /*-----------------------------------------------------------------------------------*/ /* DropDown Menu - http://users.tpg.com.au/j_birch/plugins/superfish/ /*-----------------------------------------------------------------------------------*/ /* $(".menu ul li").horizontalMenu({ timeHide: 900 }); */ $("ul.sf-menu").supersubs({ minWidth: 13, // minimum width of sub-menus in em units maxWidth: 25, // maximum width of sub-menus in em units extraWidth: 1 // extra width can ensure lines don't sometimes turn over // due to slight rounding differences and font-family }).superfish({ delay: 400, Speed: 'normal', animation: {height:'show'}, // slide-down effect without fade-in autoArrows: true, }); $("#responsive-nav select").change(function() { window.location = $(this).find("option:selected").val(); }); /*-----------------------------------------------------------------------------------*/ /* Navigation Animation /*-----------------------------------------------------------------------------------*/ $('nav ul.sf-menu ul li a').mouseover(function () { $(this).stop().animate({ paddingLeft: "22px" }, 100 ); }); $('nav ul.sf-menu ul li a').mouseout(function () { $(this).stop().animate({ paddingLeft: "17px" }, 100 ); }); /*-----------------------------------------------------------------------------------*/ /* MOBILE MENU /*-----------------------------------------------------------------------------------*/ $('.sf-menu').mobileMenu(); //Responsive Select Menu if (!$.browser.opera) { $('select.select-menu').each(function(){ var title = $(this).attr('title'); if( $('option:selected', this).val() != '' ) title = $('option:selected',this).text(); $(this) .css({'z-index':10,'opacity':0,'-khtml-appearance':'none'}) .after('' + title + '') .change(function(){ val = $('option:selected',this).text(); $(this).next().text(val); }) }); }; /*-----------------------------------------------------------------------------------*/ /* Pretty Photo /*-----------------------------------------------------------------------------------*/ $("a[rel^='prettyPhoto']").prettyPhoto({ animation_speed: 'fast', /* fast/slow/normal */ slideshow: 5000, /* false OR interval time in ms */ autoplay_slideshow: false, /* true/false */ opacity: 0.80, /* Value between 0 and 1 */ show_title: true, /* true/false */ allow_resize: true, /* Resize the photos bigger than viewport. true/false */ default_width: 500, default_height: 344, counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */ theme: 'pp_default', /* light_rounded / dark_rounded / light_square / dark_square / facebook */ horizontal_padding: 20, /* The padding on each side of the picture */ hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */ wmode: 'opaque', /* Set the flash wmode attribute */ autoplay: true, /* Automatically start videos: True/False */ modal: false, /* If set to true, only the close button will close the window */ deeplinking: false, /* Allow prettyPhoto to update the url to enable deeplinking. */ overlay_gallery: true, /* If set to true, a gallery will overlay the fullscreen image on mouse over */ keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */ changepicturecallback: function(){}, /* Called everytime an item is shown/changed */ callback: function(){}, /* Called when prettyPhoto is closed */ ie6_fallback: true, markup: '
\
 
\
\
\
\
\
\
\
\
\
\
\
\ Expand \
\ next \ previous \
\
\
\
\ Previous \

0/0

\ Next \
\

\ {pp_social} \ Close \
\
\
\
\
\
\
\
\
\
\
\
\
', gallery_markup: '', image_markup: '', flash_markup: '', quicktime_markup: '', iframe_markup: '', inline_markup: '
{content}
', custom_markup: '', social_tools: '
' /* html or false to disable */ }); /*-----------------------------------------------------------------------------------*/ /* Ajax Portfolio /*-----------------------------------------------------------------------------------*/ $('.ajaxloading').fadeIn(600); $(window).load(function(){ $('.ajaxloading').fadeOut(600); }); var portfolioContainer = $('#portfolio-container'); var portfoliourl = portfolioContainer.find('.portfolio-cont-wrap').attr('data-url'); var portfolioItems = $('.portfolio-item'); $('.portfolio-item a').click(function(e) { if (!$(this).parent().hasClass('portfolio-contain')) { portfolioItems.removeClass('portfolio-contain'); $(this).parent().addClass('portfolio-contain'); var portId = $(this).parent().attr('id').split('portfolio-')[1]; LoadingPortfolio(portId) } e.preventDefault() }); function newNextPrev(a) { var b = getNextPortfolio(portId); var c = getPrevPortfolio(portId); $('#next-port').attr('data-id', b); $('#prev-port').attr('data-id', c) } function LoadingPortfolio(portId, b) { if (!b) { b = false } var c = getNextPortfolio(portId); var d = getPrevPortfolio(portId); if (b == false) { var e = $('.ajaxloading'); e.fadeIn(200); closeContainer(); portfolioContainer.find('.portfolio-cont-wrap').load(portfoliourl, {portid: portId, portnext: c, portprev: d}, function() { LoadPortfolio(); openContainer(); e.fadeOut(200) }) } if ($().scrollTo) { jQuery.scrollTo('.ajaxloading', 400, { offset: -5 }) } } function closeContainer() { if (portfolioContainer.height() != 0) { portfolioContainer.find('.portfolio-cont-wrapper').stop(true).animate({opacity: 0}, 300); portfolioContainer.stop(true).animate({ height: 0 }, 500, 'easeOutCubic') } } function openContainer() { portfolioContainer.stop(true).animate({height: portfolioContainer.find('#portfolio-cont').outerHeight()}, 650, 'easeOutCubic', function() { portfolioContainer.css({height: 'auto'}) }) } function getNextPortfolio(portId) { var b = $('#container .portfolio-cont-yes').first().attr('id').split('portfolio-')[1]; var c = $('#portfolio-' + portId).next(); if (c.length != 0) { while (c.hasClass('portfolio-cont-yes') == false && c.length != 0) { c = c.next() } if (c.length != 0) { var b = c.attr('id').split('portfolio-')[1] } } return b } function getPrevPortfolio(portId) { var b = jQuery('#container .portfolio-cont-yes').last().attr('id').split('portfolio-')[1]; var c = jQuery('#portfolio-' + portId).prev(); if (c.length != 0) { while (c.hasClass('portfolio-cont-yes') == false && c.length != 0) { c = c.prev() } if (c.length != 0) { var b = c.attr('id').split('portfolio-')[1] } } return b } function LoadPortfolio() { $('#next-port, #prev-port').click(function() { var portId = $(this).attr('data-id'); portfolioItems.removeClass('portfolio-contain'); $('#portfolio-' + portId).addClass('portfolio-contain'); LoadingPortfolio(portId); return false }); $('.portfolio-close').click(function() { $('html,body').animate({scrollTop: $('body').offset().top}, 2000, 'easeOutCubic'); portfolioItems.removeClass('portfolio-contain'); $('#portfolio-container').animate({ height: 0}, 500, 'easeOutCubic', function(){ $('.ajaxslider').remove(); // video and audio stop playing }); return false }) } /*-----------------------------------------------------------------------------------*/ /* fitVids /*-----------------------------------------------------------------------------------*/ $(".vcontainer").fitVids(); /*-----------------------------------------------------------------------------------*/ /* MediaElement Player /*-----------------------------------------------------------------------------------*/ $('audio,video').mediaelementplayer({ features: ['playpause','progress','current','duration','tracks','volume','fullscreen','sourcechooser'], audioWidth: '100%', }); });