// ------------------------------------------------------------------------- /** * Global Initializer * Site-wide initializers for elements */ var objGlobals = { init : function() { objGlobals.init_supersized(); objGlobals.init_page_view(); objGlobals.init_navigation(); objGlobals.init_modal_box(); objGlobals.init_scroll(); objGlobals.init_content_control(); objGlobals.init_sec_content_control(); objGlobals.hide_content(); objGlobals.init_thumb_list(); objGlobals.init_tooltips(); objGlobals.init_thumbs_mouse_scroll(); objGlobals.init_video_player(); $(window).resize(function(){ objGlobals.hide_content(); objGlobals.init_thumbs_mouse_scroll(); }); var bodyID = $('body').attr('id'); switch(bodyID) { case 'projects-page': objProjectsPage.init(); break; case 'project-detail-page': objProjectDetailPage.init(); break; case 'contact-page': objContactPage.init(); break; case 'awards-page': objProjectsPage.init(); break; case 'press-page': objProjectsPage.init(); break; case 'how_we_think-page': objProjectsPage.init(); break; default: break; } }, // ------------------------------------------------------------------------- /** * Supersized Initializer * Supersized is used for fullscreen background slideshow * Further information : http://buildinternet.com/project/supersized/docs.html */ init_supersized : function() { var array = [ {image : 'http://www.avciarchitects.com/cdn/media/pages/Home1.jpg', title : 'image_1'},{image : 'http://www.avciarchitects.com/cdn/media/pages/Home2.jpg', title : 'image_2'},{image : 'http://www.avciarchitects.com/cdn/media/pages/Home3a.jpg', title : 'image_3'},{image : 'http://www.avciarchitects.com/cdn/media/pages/Home4.jpg', title : 'image_4'},{image : 'http://www.avciarchitects.com/cdn/media/pages/CNN.jpg', title : 'video_5'},{image : 'http://www.avciarchitects.com/cdn/media/pages/Home5.jpg', title : 'image_6'},{image : 'http://www.avciarchitects.com/cdn/media/pages/Home6.jpg', title : 'image_7'},{image : '', title : 'image_8'},{image : 'http://www.avciarchitects.com/cdn/media/pages/Home12.jpg', title : 'image_9'},{image : 'http://www.avciarchitects.com/cdn/media/pages/Home14.jpg', title : 'image_10'},{image : 'http://www.avciarchitects.com/cdn/media/pages/Home15.jpg', title : 'image_11'},{image : 'http://www.avciarchitects.com/cdn/media/pages/Home16.jpg', title : 'image_12'} ]; jQuery(function($){ $.supersized({ //Functionality keyboard_nav : 1, //Keyboard navigation on/off image_protect : 1, //Disables image dragging and right click with Javascript image_path : 'img/', //Default image path slide_interval :3500, min_width : 1024, //Min width allowed (in pixels) min_height : 768, //Min height allowed (in pixels) horizontal_center : 1, thumbnail_navigation : 0, slides : array }); }); }, // --------------------------------------------------------------------- /** * Will set the minimum size of the wrapper */ init_page_view : function() { $(window).load(function() { $('#loading').fadeOut(450); var $nav = $('#nav'); var $primary = $('#nav .primary>ul'); var $secondary = $('#nav .secondary>ul'); $nav.css({ position: "absolute", visibility: "hidden", display: "block" }); var $wrapWidth = $primary.outerWidth(true) + $secondary.outerWidth(true); $nav.css({ position: "", visibility: "", display: ""}); $('#wrap').css({minWidth: $wrapWidth + 1}); var offsetTop = ($('#content-wrap').length) ? $('#content-wrap').offset().top : 0; var contentHeight = ($('#content-wrap').length) ? $('#content-wrap').outerHeight() : 0; var secContentHeight = ($('#sec-content-wrap').length) ? $('#sec-content-wrap').outerHeight() : 0; var footerHeight = ($('#footer').length) ? $('#footer').outerHeight() : 0; var totalHeight = Math.round(offsetTop + contentHeight + secContentHeight + footerHeight); var minHeight = $('#wrap').css('minHeight').split('px')[0]; if(totalHeight > minHeight) { $('#wrap').css({minHeight: totalHeight}); } if($('#content-wrap').hasClass('delayed')) { $('#content-wrap').hide().removeClass('delayed'); setTimeout('$("#content-wrap").fadeIn(500)' , 800); } if($('#sec-content-wrap').hasClass('delayed')) { $('#sec-content-wrap').hide().removeClass('delayed'); setTimeout('$("#sec-content-wrap").fadeIn(500)' , 800); } objGlobals.show_content(); }); }, // --------------------------------------------------------------------- /** * Initializes click effects of the navigation and the menu button */ init_navigation : function() { $('#nav .primary>ul>li>a').click(function(e){ var $this = $(this); var $show = $this.parent('li').find('.sub-nav'); var $visible = $('#nav .sub-nav:visible'); if(!$inAnimation){ $inAnimation = true; if($show.length){ e.preventDefault(); if($visible.length){ if($show[0] == $visible[0]) { $this.removeClass('visible'); $show.animate({ opacity: 0 },200,function(){ $show.hide(450,function(){ $inAnimation = false; }); }); //$this.animate({ // backgroundPosition: '0 0' //},650); } else { $show.show(450, function(){ $visible.animate({ opacity: 0 },200,function(){ $('.visible').removeClass('visible'); $this.addClass('visible'); $show.animate({ opacity: 1 },200); $visible.hide(450,function(){ $inAnimation = false; }); }); //$('.visible').animate({ // backgroundPosition: '0 0' //},650); //$this.animate({ // backgroundPosition: '0 -200px' //},650); }); } } else { $show.show(450, function(){ $show.animate({ opacity: 1 },200,function(){ $this.addClass('visible'); $inAnimation = false; }); }); //$this.animate({ // backgroundPosition: '0 -200px' //},650); } } } }); $('#menu-button').click(function(e){ if(!$inAnimation){ $inAnimation = true; e.preventDefault(); var $this = $('.visible'); var $visible = $('#nav .sub-nav:visible'); var $nav = $('#nav'); var $menubutton = $('#menu-line a'); if($visible.length) { $visible.animate({ opacity: 0 },200,function(){ $this.removeClass('visible'); $visible.hide(450,function(){ $inAnimation = false; }); }); $this.animate({ backgroundPosition: '0 0' },650); } else { if($('#nav:visible').length) { $nav.slideUp(450,function(){ $inAnimation = false; $menubutton.removeClass('up'); }); } else{ $nav.slideDown(450,function(){ $inAnimation = false; $menubutton.addClass('up'); }); } } } }); }, // --------------------------------------------------------------------- /** * Shows the content if #content-wrap has class .short-content */ show_content : function() { if($('#content-wrap').hasClass('short-content')) { var width = $('#content').outerWidth(); if($('#content-wrap').hasClass('hidden')){ $('#content-wrap').animate({ left: 0 }, { duration: 600, speicalEasing: { left: 'easeOutCubic' }, complete: function() {$('#content-wrap').removeClass('hidden');} }); } else { $('#content-wrap').addClass('hidden'); $('#content-wrap').animate({ left: -width }, { duration: 600, specialEasing: { left: 'easeOutCubic' } }); } } }, // --------------------------------------------------------------------- /** * Hides the content. Actually it keeps the content hidden. Only to use on window resize. */ hide_content : function() { if($('#content-wrap').hasClass('hidden')){ var width = $('#content').outerWidth(); $('#content-wrap').css({ left: -width }); } }, // --------------------------------------------------------------------- /** * Initializes modal box */ init_modal_box : function() { // Modal Box - Functionality $('.has-modal').click(function(e){ e.stopPropagation(); e.preventDefault(); $(this).siblings('.modal-box').slideToggle(250); $(this).toggleClass('active'); }); // Modal Box - Close $(document).click(function(){ if($('.modal-box:visible').length){ $visible = $('.modal-box:visible'); $visible.slideUp(250); $visible.siblings('.has-modal').removeClass('active'); } }); }, // --------------------------------------------------------------------- /** * Initializes scroll for the content. Scrollable div should have class .scroll */ init_scroll : function() { $('.scroll').each( function() { $(this).jScrollPane( { showArrows: $(this).is('.arrow') } ); var scroll_api = $(this).data('jsp'); var throttleTimeout; $(window).bind( 'resize', function() { if ($.browser.msie) { // IE fires multiple resize events while you are dragging the browser window which // causes it to crash if you try to update the scrollpane on every one. So we need // to throttle it to fire a maximum of once every 50 milliseconds... if (!throttleTimeout) { throttleTimeout = setTimeout( function() { scroll_api.reinitialise(); throttleTimeout = null; }, 50 ); } } else {scroll_api.reinitialise();} } ); } ); }, // --------------------------------------------------------------------- /** * Initializes content control button. Only short content has this button. */ init_content_control : function() { $('#content-control a').click(function(e){ e.preventDefault(); objGlobals.show_content(); }); }, // --------------------------------------------------------------------- /** * Initializes secondary content control button. */ init_sec_content_control : function() { $('#sec-content-control a').click(function(e){ e.preventDefault(); $inAnimation = true; $(this).toggleClass('up'); $('#sec-content').slideToggle(500,function(){ $inAnimation = false; }); }); }, // --------------------------------------------------------------------- /** * Initializes thumbnails on secondary content */ init_thumb_list : function() { var thumbsWidth = 0; $('#sec-content').height($('.thumb-list').outerHeight()); $('.thumb-list').find('li').each(function(){ thumbsWidth += $(this).outerWidth(true); }); $('.thumb-list').width(thumbsWidth); $('.thumb-list a') .mouseover(function(){ $(this).children('img').stop().animate( {opacity: 1}, {duration: 450}) }) .mouseout(function(){ $(this).children('img').stop().animate( {opacity: 0.6}, {duration: 450}) }); }, // --------------------------------------------------------------------- /** * Initializes thumbnails mouse scroll. */ init_thumbs_mouse_scroll : function() {$('.thumb-list').mousescroll();}, // --------------------------------------------------------------------- /** * Initializes tooltips. * Takes its content from the title images. */ init_tooltips : function() { $('.tooltip').each(function(){ var title = $(this).children('img').attr('title'); var html = '
' + title + '
' + projectTitle + '