/**
* Silicon Theme
*
* Developed by: Arlind Nushi
* Designed by: Art Ramadani
*/
;(function($, window, undefined)
{
// platform detection
var html = $('html'),
os = '';
if (navigator.appVersion.indexOf("Win")!=-1) os = "win";
if (navigator.appVersion.indexOf("Mac")!=-1) os = "mac";
if (navigator.appVersion.indexOf("X11")!=-1) os = "unix";
if (navigator.appVersion.indexOf("Linux")!=-1) os = "linux";
html.addClass(os);
// Site Header Clone for Sticky menu
var site_header = $(".sticky-menu #site_header"),
sticky_header = site_header.clone(),
site_header_height = site_header.outerHeight(),
win = $(window),
sticky_menu_interval,
sticky_menu_timeout = 25;
site_header.after(sticky_header);
sticky_header.addClass('fixed').wrapInner('
');
site_header_height *= 1.5;
$(window).on({
scroll: function(e)
{
window.clearTimeout(sticky_menu_interval);
sticky_menu_interval = setTimeout(check_sm_pos, sticky_menu_timeout);
}
});
function check_sm_pos()
{
if(site_header_height < win.scrollTop())
{
sticky_header.addClass('visible');
}
else
{
sticky_header.removeClass('visible');
}
}
check_sm_pos();
// Menu
var menu_z_index_count = 150;
var subMenuHoverSetup = function(item, level)
{
if( ! level)
level = 1;
var sub_menu = item.find('> ul');
var has_sub_menu = sub_menu.length > 0;
var fade_delay = 0.400;
var easing = 'easeInOutQuad';
var time_out_delay = 300;
// Has Sub Menu (1st level)
if(has_sub_menu)
{
// Timeout (for Hover out delay)
var time_out_id = 0;
// Set Icon
if(level == 1)
{
item.find('> a').append('');
}
item.addClass('has_sub');
// Determine Height
var sub_menu_height = sub_menu.height();
if(sub_menu_height == 0)
{
var _parent = sub_menu.parent();
for(var i=1; i<=level; i++)
{
_parent.show();
_parent = _parent.parent();
}
sub_menu_height = sub_menu.height();
}
sub_menu.data('height', sub_menu_height).addClass('noheight');
// Hover In
item.on('mouseenter', function(ev)
{
menu_z_index_count++;
if(time_out_id)
{
window.clearTimeout(time_out_id);
time_out_id = 0;
return;
}
var s_height = sub_menu.data('height');
sub_menu.css({display: 'block', zIndex: menu_z_index_count});
TweenMax.to(sub_menu.fadeTo(0,0), fade_delay, {css: {autoAlpha: 1, height: s_height}, ease: Power4.easeOut, onComplete: function(){
sub_menu.removeClass('noheight').height('auto');
}});
});
// Hover Out
item.on('mouseleave', function(ev)
{
window.clearTimeout(time_out_id);
time_out_id = setTimeout(function(){
TweenMax.to(sub_menu, fade_delay, {css: {autoAlpha: 0, height: 0}, ease: Power4.easeIn, onComplete: function()
{
sub_menu.css('display', 'none').addClass('noheight');
}});
time_out_id = 0;
}, time_out_delay);
});
// Continue Recursion
var sub_menu_items = sub_menu.find('> li');
sub_menu_items.each(function(i)
{
var sub_menu_item = $(this);
subMenuHoverSetup(sub_menu_item, parseInt(level, 10)+1);
});
}
},
subMenuHoverSetup2 = function(item, level)
{
if( ! level)
level = 1;
var sub_menu = item.find('> ul');
var has_sub_menu = sub_menu.length > 0;
var fade_delay = 0.350;
var easing = 'easeInOutQuad';
var time_out_delay = 50;
// Has Sub Menu (1st level)
if(has_sub_menu)
{
// Timeout (for Hover out delay)
var time_out_id = 0;
// Set Icon
if(level == 1)
{
item.find('> a').append('');
}
item.addClass('has_sub');
sub_menu.css({
visibility: 'hidden',
opacity: 0
});
// Hover In
item.on('mouseenter', function(ev)
{
menu_z_index_count++;
if(time_out_id)
{
window.clearTimeout(time_out_id);
time_out_id = 0;
return;
}
sub_menu.css({zIndex: menu_z_index_count});
TweenMax.to(sub_menu, fade_delay, {css: {autoAlpha: 1}, ease: Sine.easeInOut});
});
// Hover Out
item.on('mouseleave', function(ev)
{
window.clearTimeout(time_out_id);
time_out_id = setTimeout(function(){
TweenMax.to(sub_menu, fade_delay, {css: {autoAlpha: 0}, ease: Sine.easeInOut});
time_out_id = 0;
}, time_out_delay);
});
// Continue Recursion
var sub_menu_items = sub_menu.find('> li');
sub_menu_items.each(function(i)
{
var sub_menu_item = $(this);
subMenuHoverSetup2(sub_menu_item, parseInt(level, 10)+1);
});
}
};
var main_menu = $("#site_header .main_menu");
var main_menu_items = main_menu.find(" > li");
if( ! $("#site_header_ul").length )
{
main_menu = $("#site_header .main_menu ul");
main_menu_items = main_menu.find(" > li");
main_menu.attr('id', 'site_header_ul');
}
main_menu_items.each(function(i)
{
var item = $(this);
subMenuHoverSetup2(item);
});
/* Select Menu */
selectnav('site_header_ul', {
activeclass: 'current_page_item',
label: main_menu.data('title') > 0 ? main_menu.data('title') : ':: Main Menu ::',
nested: true,
indent: '-'
});
var snav = $(".selectnav");
snav.wrap('').on({
change: function()
{
mm_placeholder.html(mm_arrow + clearIndenter(snav.find('option:selected').html()));
}
});
var mobile_menu = $(".mobile_menu"),
mm_placeholder = $(''),
mm_arrow = '» ',
clearIndenter = function(str)
{
if( ! str)
return '';
return str.replace(/^-*/, '');
};
mobile_menu.append(mm_placeholder);
mm_placeholder.html(mm_arrow + clearIndenter(snav.find('option:selected').html()));
/* Outer Title Markup */
var outer_title_table = $('');
var outer_title_table_rc = $('');
outer_title_table.addClass('outer_title_table').attr('width', '100%');
outer_title_table_rc.addClass('outer_title_table').attr('width', '100%');
var otb_row = $('
');
var otb_row_rc = $('
');
var text_env = $(' | ').addClass('text_env');
var right_border = $(' | ').addClass('right_border');
var page_top = $(' | ').html('Top').addClass('page_top');
var right_content = $(' | ').addClass('right_content_title normal');
otb_row.append(text_env).append(right_border).append(page_top);
otb_row_rc.append(text_env.clone()).append(right_border.clone()).append(right_content.clone());
outer_title_table.append(otb_row);
outer_title_table_rc.append(otb_row_rc);
$("h1.title, h2.title:not(footer .title), h3.title, h4.title").each(function()
{
var $this = $(this);
var tag_name = $this.get(0).tagName;
var html = $this.html().toString();
var heading = $('<'+tag_name+' />').html(html);
var right_content = $this.find('.right_content'),
table_ins,
classes = $this[0].className.split(' ');
if(right_content && right_content.length > 0)
{
table_ins = outer_title_table_rc.clone();
$this.after(table_ins).detach();
for(var i=0; i 0)
{
var drop_off_delay = 0.3;
var drop_off_start_from = {left: -40, top: -40, autoAlpha: 0, scale: 2.5};
social_networks_dropoff.each(function(){
var $this = $(this);
var $items = $this.children();
$items.addClass('relative');
var del = 0, del_step = 0.1;
$items.each(function(){
var $item = $(this);
TweenMax.from($item, drop_off_delay, {css: drop_off_start_from, delay: del});
del += del_step;
});
})
}
// Slider
if($.isFunction($.fn.fadeOSlider))
{
// Cycle Slider (mostly on homepage)
var cycle_slider = $("#cycle_slider");
var nav = cycle_slider.find('.control_nav');
cycle_slider.fadeOSlider({
numbers: nav,
selector: '.slide',
keyboard: true
});
// Slideshow Slider
var slideshow = $(".slideshow");
slideshow.each(function(i)
{
var $slideshow = $(this);
$slideshow.fadeOSlider({
selector: 'img',
});
})
// Portfolio Item Details
var portfolio_item_details = $(".portfolio_item_details .images");
var pid_prevnext = $('.portfolio_item_details .prev_next_nav');
portfolio_item_details.fadeOSlider({
prevNext: pid_prevnext,
keyboard: true
});
}
// Touch Carousel - by Arlind Nushi
if($.isFunction($.fn.anSwiper))
{
var features_blocks = $("#features_blocks .features_blocks");
var features_blocks_nav = $("#features_blocks .features_blocks_nav");
features_blocks.each(function()
{
var $this = $(this),
_navscope = parseInt($this.data('navscope'), 10),
_navstep = parseInt($this.data('navstep'), 10);
if(_navscope == 0)
_navscope = 4;
$this.anSwiper({
selector: '.columns',
nextprev: features_blocks_nav,
navscope: _navscope,
navstep: _navstep,
duration: 700,
ease: Power4.easeOut
});
});
var team_members = $(".team_members");
var team_members_nav = $(".team_members_nav");
team_members.anSwiper({
selector: '.columns',
nextprev: team_members_nav,
navscope: 4,
navstep: 1,
duration: 700,
ease: Power4.easeOut
});
}
// Features Tabs Hover Effect
if(features_blocks)
{
var feature_block = features_blocks.find('.feature_block'),
fb_animation_delay = 0.2,
fb_ease_1 = Power0.easeInOut,
fb_ease_2 = Power2.easeInOut;
feature_block.each(function()
{
var $block = $(this),
$hover_el = $(''),
$block_h3 = $block.find('h3'),
$block_content = $block.find('.content');
$block.prepend($hover_el);
var def_top = parseInt($hover_el.css('top'), 10),
def_height = $hover_el.outerHeight(true),
h3_color = $block_h3.css('color'),
content_color = $block_content.css('color'),
timeline;
$hover_el.data({
top: def_top,
height: def_height
});
var textHoverIn = function()
{
TweenMax.to([$block_h3, $block_content], 0.1, {css: {color: '#FFF'}, ease: Sine.easeInOut});
}
var textHoverOut = function()
{
TweenMax.to($block_h3, 0.1, {css: {color: h3_color}, ease: Sine.easeInOut});
TweenMax.to($block_content, 0.1, {css: {color: content_color}, ease: Sine.easeInOut});
}
$block.on({
mouseenter: function()
{
timeline = new TimelineMax({delay: 0.1});
timeline.append( TweenMax.to($hover_el, fb_animation_delay, {css: {width: '100%', left: '0%'}, ease: fb_ease_1}) );
timeline.append( TweenMax.to($hover_el, fb_animation_delay, {css: {height: '100%', top: 0}, ease: fb_ease_2, onStart: textHoverIn}) );
},
mouseleave: function()
{
TweenMax.killTweensOf([$hover_el, $block_h3, $block_content, timeline]);
timeline = new TimelineMax();
timeline.append( TweenMax.to($hover_el, fb_animation_delay, {css: {height: def_height, top: def_top}, ease: fb_ease_1, onStart: textHoverOut}) );
timeline.append( TweenMax.to($hover_el, fb_animation_delay, {css: {width: '0%', left: '50%'}, ease: fb_ease_2}) );
}
});
});
}
// Direction Avare Portfolio Hover (Copyright 2012, Codrops)
var portfolio_item = $(".portfolio_item");
if($.isFunction($.fn.hoverdir))
{
portfolio_item.each(function(i)
{
var $item = $(this);
$item.hoverdir();
});
}
$("#portfolio_items").on('click', '.immediate_open', function(ev)
{
ev.preventDefault();
var $this = $(this);
if($this.data('standalone'))
{
Shadowbox.open({
player: ($this.attr('href').match(/(youtube\.com|vimeo\.com)/) ? 'iframe' : "img"),
title: $this.data('title'),
content: $this.attr('href')
});
}
else
if($this.data('gallery'))
{
var gallery_list = $this.data('gallery').split(','),
gallery_items = [],
gallery_item,
options = {
continuous: true,
counterType: "skip"
};
for(var i in gallery_list)
{
gallery_item = gallery_list[i];
gallery_item = {
player: (gallery_item.match(/(youtube\.com|vimeo\.com)/) ? 'iframe' : "img"),
title: $this.data('title'),
content: gallery_item,
options: options
};
gallery_items.push(gallery_item);
}
Shadowbox.open(gallery_items);
}
else
if($this.attr('target').length > 0)
{
window.open($this.attr('href'));
}
});
// Blog Hover Images
var post_image = $(".post_entry .post_image, .member .image"),
hover_delay = 0.2,
icons_drop_delay = 0.3,
delay_incr = 0.2;
post_image.imagesLoaded(function()
{
post_image.each(function()
{
var $img = $(this),
$hover = $img.find('.hover'),
$hover_links = $hover.find('a'),
links_length = $hover_links.length;
if($hover.length == 0)
return;
$img.on({
mouseenter: function()
{
var img_height = $img.height();
$hover_links.css({
top: -img_height/2
});
TweenMax.to($hover, hover_delay, {css: {autoAlpha: 1}});
$hover_links.each(function(i)
{
var $this = $(this);
var top = img_height / 2 - ($this.outerHeight() / 2);
TweenMax.to($this, icons_drop_delay + delay_incr * i, {css: {top: top}, ease: Expo.easeOut});
});
},
mouseleave: function()
{
var img_height = $img.height();
TweenMax.killTweensOf([$hover, $hover_links]);
TweenMax.to($hover, hover_delay, {css: {autoAlpha: 0}});
$hover_links.each(function(i)
{
var $this = $(this);
var top = img_height / 2 - ($this.outerHeight() / 2);
TweenMax.to($this, icons_drop_delay + delay_incr * i, {css: {top: top}, ease: Expo.easeIn});
$hover_links.each(function(i)
{
var $this = $(this);
var top = -img_height/2;
TweenMax.to($this, icons_drop_delay + delay_incr * (links_length - i), {css: {top: top}});
});
});
}
});
});
});
// Testimonials Widget (Footer)
if($.isFunction($.fn.anTweetRoller))
{
var testimonials = $(".testimonials"),
testimonials_nav = $(".testimonials_nav");
testimonials.anTweetRoller({
switchDelay: 800,
puffScale: 1.2,
numbers: testimonials_nav,
effect: 'puff'
});
// Testimonials 2
var testimonials_2 = $(".testimonials_2");
testimonials_2.anTweetRoller({
switchDelay: 800,
effect: 'fade',
ease: Power0.easeInOut
});
// Tweets
var tweets_widget = $(".tweets_widget");
tweets_widget.each(function()
{
var $this = $(this),
tweets = $this.find(".tweets"),
tweets_nav = $this.find(".tweets_nav"),
opts = {
switchDelay: 800,
puffScale: 1.2,
effect: 'puff',
ease: Power0.easeInOut,
numbers: tweets_nav,
num: 3
};
if(tweets.data('fetch'))
{
$.getJSON('http://api.twitter.com/1/statuses/user_timeline.json?screen_name=' + tweets.data('user') + '&count=' + tweets.data('count') + '&callback=?', function(resp)
{
var tweet = {}, tweet_dom, date;
tweets.find('li').remove();
for(var i in resp)
{
tweet = resp[i];
date = new Date(tweet.created_at);
tweet_dom = '';
tweet_dom += '';
tweet_dom += '';
tweets.append(tweet_dom);
}
tweets.anTweetRoller(opts);
})
}
else
{
tweets.anTweetRoller(opts);
}
});
}
// Wide Slider
if($.isFunction($.fn.wideslider))
{
var wideslider_env = $("#wideslider"),
hh = $("header").outerHeight();
wideslider_env.wideslider({
wrapper: '#wrap',
delay: 800,
nextPrev: $(".wideslider_nextprev"),
prevNextOnKeyboard: true,
progressTimer: true,
autoCenterCaptions: true,
headerHeight: hh,
autoCenterVerticalOffset: -25,
//captions: false, // will hide text captions
});
wideslider_env.wideslider('autoCenter');
}
// Sidebar Tabs
$(".sb_tabs").each(function()
{
var $sb_tabs = $(this),
$sb_tabs_title = $sb_tabs.find('.sb_tabs_title a'),
$sb_tabs_content = $sb_tabs.find('.sb_tabs_content'),
current = $sb_tabs_title.filter('.active').attr('href'),
current_title;
if(current && current.length > 0)
{
current_title = $sb_tabs_title.filter('.active');
current = $sb_tabs_content.find(current);
}
else
{
current_title = $sb_tabs_title.first();
var first_title = current_title.attr('href');
current = $sb_tabs_content.find(first_title);
}
// Set Active
if(current && current.length)
{
$sb_tabs_content.find('> div').not(current).hide();
current.show();
$sb_tabs_title.not(current_title).removeClass('active');
current_title.addClass('active');
}
$sb_tabs_title.on({
click: function(ev)
{
ev.preventDefault();
var $title = $(this);
var id = $title.attr('href');
var to_show = $sb_tabs_content.find(id);
if(id == current_title.attr('href'))
return;
var masonry = to_show.find('.masonry');
if(masonry && masonry.length)
{
to_show.show();
masonry.masonry('reload');
to_show.hide();
}
if(to_show && to_show.length)
{
current_title.removeClass('active');
$title.addClass('active');
current.slideUp('normal');
to_show.slideDown('normal');
current_title = $title;
current = to_show;
}
}
});
});
// Masonry Tags
if($.isFunction($.fn.masonry))
{
$('.sidebar_entry .tagcloud').masonry({
itemSelector : 'a',
columnWidth : 7
});
}
// Separated Lists
$(".separated_list").each(function()
{
var $list = $(this);
var $items = $list.children();
$items.each(function(i)
{
var $item = $(this);
var sep = $('–');
$item.after(sep);
if(i > 0)
{
}
});
});
// Portfolio Categories
if($.isFunction($.fn.isotope))
{
var portfolio_items = $("#portfolio_items"),
portfolio_item = $("#portfolio_items .portfolio_item"),
isotope_options = {
masonry:
{
itemSelector: '.portfolio_item',
columnWidth: 1/4,
gutterWidth: 0
},
animationOptions: {
duration: 750,
easing: 'linear',
queue: false
}
};
portfolio_items.isotope(isotope_options);
// Isotope Filter
var portfolio_filter = $("#portfolio_filter li a");
portfolio_filter.each(function()
{
var $category = $(this);
var $filter = $category.data('filter');
$category.on({
click: function(ev)
{
ev.preventDefault();
portfolio_filter.parent().removeClass('active');
$category.parent().addClass('active');
window.location.hash = $filter == '*' ? '' : ('category-' + $filter);
portfolio_items.isotope({
filter: function(index)
{
var item = $(this),
filters = item.data('filter');
if($filter == '*' || filters.match(new RegExp($filter, 'i')))
{
return true;
}
return false;
}
});
}
});
});
// Show current category from url hash
var url_hash = window.location.hash.toString().replace('#', '');
if(url_hash.match(new RegExp('^category-(.*?)$', 'i')))
{
var category_id = url_hash.replace(/^category-/i, '');
var filterer = '[data-filter="' + category_id + '"]';
portfolio_filter.parent().removeClass('active');
portfolio_filter.filter(filterer).parent().addClass('active');
var filter_name = filterer.match(/"(.*?)"/);
if(filter_name.length > 1)
{
filter_name = filter_name[1];
}
portfolio_items.isotope({filter: function(){
var item = $(this),
filters = item.data('filter');
if(filter_name == '*' || filters.match(new RegExp(filter_name, 'i')))
{
return true;
}
return false;
}});
}
}
/* Infinite Scroll */
var endless_scrolling = jQuery(".endless_scrolling");
if(jQuery.isFunction(jQuery.fn.infinitescroll) && endless_scrolling.length > 0)
{
var pagination_link = jQuery('.endless_scroll_pagination a'),
child_class = '.portfolio_item';
endless_scrolling.infinitescroll({
navSelector: pagination_link,
nextSelector: pagination_link,
itemSelector: child_class,
onIsDone: function(){
TweenMax.to(pagination_link, 0.5, {css: {autoAlpha: 0}});
},
loading: {
finishedMsg: '',
img: '',
msgText: ''
}
//,debug: true
},
function(newElements){
var new_items = jQuery(newElements);
var active_category = jQuery(".is_portfolio_filter .active a").data('filter');
new_items.hide();
pagination_link.fadeTo(0,0);
TweenMax.to(pagination_link, 0.5, {css: {autoAlpha: 1}});
new_items.imagesLoaded(function()
{
endless_scrolling.isotope('addItems', new_items, function()
{
new_items.show();
// Filter Results
endless_scrolling.isotope({filter: function(){
var $this = $(this),
filters = $this.data('filter');
if( ! active_category || active_category == '*' || active_category == 'all')
{
return true;
}
return filters.indexOf(active_category) >= 0;
}
});
new_items.each(function()
{
var $item = $(this);
$item.imagesLoaded(function()
{
$item.hoverdir();
})
})
});
});
});
// Make Manual Scroller via Button
if(endless_scrolling.hasClass('endless_scrolling_manual'))
{
jQuery(window).unbind('.infscr');
}
var infscr = endless_scrolling.data('infinitescroll');
pagination_link.on('click', function(ev)
{
ev.preventDefault();
infscr.retrieve();
if( infscr.options.state.isDone )
{
pagination_link.fadeTo(500, 0);
}
});
}
// Silicon Placeholders
var ph_delay = 0.2;
$("form div.placeholder").each(function()
{
var $placeholder = $(this);
var label = $placeholder.find('> label');
var input = $placeholder.find('> input, > textarea');
input.on({
focus: function(ev)
{
$placeholder.addClass('focused');
TweenMax.to(label, ph_delay, {css: {autoAlpha: 0}});
},
blur: function(ev)
{
$placeholder.removeClass('focused');
if(input.val().length == 0)
TweenMax.to(label, ph_delay, {css: {autoAlpha: 1}});
}
});
label.on({
click: function(ev)
{
input.focus();
}
});
if(input.val().length > 0)
{
label.css('opacity', 0).css('visibility', 'hidden');
}
});
// Block Quotes
var blockquotes = $('blockquote');
blockquotes.each(function(i)
{
var blockquote = $(this),
quotes_o = $(''),
quotes_c = $('');
blockquote
.append(quotes_o)
.append(quotes_c);
});
// Code Blocks
var pres = $('pre');
pres.each(function(i)
{
var pre = $(this);
var hash = $('');
pre.append(hash);
});
if($.isFunction($.fn.tabs))
{
// Tabs
var tabs = $('div.tabs');
tabs.each(function()
{
var tab_env = $(this);
tab_env.tabs();
});
// Accordion
var accordion = $('div.accordion');
accordion.each(function()
{
var accordion_env = $(this);
accordion_env.accordion();
});
}
// Progress Bars
var pb_fill_bar_delay = 1;
$(".progress_bars").each(function()
{
var $progress_bar = $(this);
var $bars = $progress_bar.find('.bar');
$bars.each(function()
{
var $bar = $(this);
var $pct = $bar.find('span[data-pct]');
var pct = parseInt($pct.data('pct'), 10);
if(pct > 100)
pct = 100;
TweenMax.to($pct, pb_fill_bar_delay, {css: {width: pct + '%'}, ease: Quad.easeOut});
});
});
// Testimonials 2 Arrow
$(".testimonials_2 blockquote").each(function()
{
var $arrow = $('');
$(this).append($arrow);
});
// JQuery Scroll Pane
if($.isFunction($.fn.jScrollPane))
{
$(".scroll-pane").each(function()
{
var $this = $(this);
$this.jScrollPane({
    showArrows: false,
    animateScroll: true,
    animateDuration: 200,
    mouseWheelSpeed: 100,
    keyboardSpeed: 100,
animateSteps: true
});
var jsp = $this.data('jsp');
});
}
// Portfolio Item Details Effects
$(".portfolio_item_details").each(function()
{
var $this = $(this),
$details = $(this),
$project_info = $details.find('.project_info'),
$project_info_close = $project_info.find('.close'),
$info_list = $details.find('.info_list'),
$info_link = $details.find('.info_link'),
$prev_next_nav = $details.find('.prev_next_nav');
$info_link.add($project_info_close).on('click', function(ev)
{
ev.preventDefault();
if($info_link.data('busy'))
return false;
$info_link.data('busy', true);
var hide_infos = $info_link.hasClass('active') || $info_link.data('no_animation'),
details_width = $details.width(),
pi_height = $project_info.height(),
pi_width = $project_info.outerWidth(),
ilink_height = $info_link.height(),
ilink_offset = $info_link.position().left,
pnn_width = $prev_next_nav.width(),
ilink_bottom = pi_height - ilink_height - 10,
ilink_left = details_width - ilink_offset - 25 - $info_link.width(),
has_animation = 1;
if($info_link.data('no_animation'))
{
has_animation = 0;
}
if(hide_infos)
{
if(typeof Cookies != 'undefined')
{
Cookies.set('portfolio_info_bar', 'hidden');
}
var timeline = new TimelineMax({
onComplete: function()
{
$info_link.removeClass('active');
$info_link.data('busy', false);
}
});
TweenMax.to($project_info, 0.5 * has_animation, {css: {left: -pi_width}, ease: Back.easeIn});
TweenMax.to($info_list, 0.3 * has_animation, {css: {top: pi_height}, delay: 0.2 * has_animation, ease: Quad.easeIn});
TweenMax.to($prev_next_nav, 0.9 * has_animation, {css: {left: 300 + ($info_list.height() == 0 ? 100 : 0)}, delay: 0.6 * has_animation});
timeline.append( TweenMax.to($info_link, 0.4 * has_animation, {css: {top: ilink_bottom}}) );
timeline.append( TweenMax.to($info_link, 0.4 * has_animation, {css: {left: ilink_left}, onComplete: function()
{
if(has_animation == 0)
{
$this.removeClass('is_hidden');
}
}}) );
}
else
{
$info_link.addClass('active');
if(typeof Cookies != 'undefined')
{
Cookies.set('portfolio_info_bar', 'visible');
}
var timeline = new TimelineMax({
onComplete: function()
{
$info_link.data('busy', false);
}
});
TweenMax.to($project_info, 0.5 * has_animation, {css: {left: 0}, ease: Back.easeIn});
TweenMax.to($info_list, 0.3 * has_animation, {css: {top: 0}, delay: 0.2, ease: Quad.easeIn});
TweenMax.to($prev_next_nav, 0.9 * has_animation, {css: {left: 0}, delay: 0.6});
timeline.append( TweenMax.to($info_link, 0.4 * has_animation, {css: {left: 0}}) );
timeline.append( TweenMax.to($info_link, 0.4 * has_animation, {css: {top: 0}}) );
}
if(has_animation == 0)
{
$info_link.data('no_animation', false);
}
});
// Check Current Visibility Status
if($this.hasClass('is_hidden'))
{
$info_link.data('no_animation', true).removeClass('active').trigger('click');
}
});
// Gallery Plugin by Arlind Nushi
if($.isFunction($.fn.anGallery))
{
var gallery = $("#an_gallery"),
hover_delay = 0.5;
gallery.anGallery({
itemSelector: '.gallery_item',
slideShow: $('.showing_image'),
detectHashChange: true
});
gallery.find('.gallery_item').each(function()
{
var $item = $(this);
var $hover_overlay = $('');
$item.append($hover_overlay).on({
mouseover: function()
{
if( ! $item.hasClass('active'))
TweenMax.to($hover_overlay, hover_delay, {css: {autoAlpha: 1}});
},
mouseout: function()
{
TweenMax.to($hover_overlay, hover_delay, {css: {autoAlpha: 0}});
}
});
});
}
// 404 Page Effect
var container_404_sad_icon = $(".container_404 .sad_icon");
if(container_404_sad_icon.length)
{
var timeline = new TimelineMax(),
ease = Quad.easeInOut,
dist = 55;
timeline.append( TweenMax.to(container_404_sad_icon, 0.5, {css: {left: -dist}, ease: ease}) );
timeline.append( TweenMax.to(container_404_sad_icon, 0.5, {css: {left: dist}, ease: ease}) );
timeline.append( TweenMax.to(container_404_sad_icon, 0.5, {css: {left: 0}, ease: ease}) );
timeline.totalDuration(.2).repeat(3);
}
// Post Thumbnails Hover - Hover Up Effect
var post_images = $(".post_entry .post_thumb .image:has(.hover_image_up)"),
phi_delay = 0.3;
post_images.each(function(i)
{
var post_image = $(this);
var img = post_image.find('img');
var hover_image_up = post_image.find('.hover.hover_image_up'),
hover_height = 0;
hover_image_up.css({
visibility: 'visible',
bottom: -hover_image_up.outerHeight()
});
post_image.on({
mouseenter: function()
{
hover_height = hover_image_up.outerHeight();
TweenMax.to(img, phi_delay, {css: {top: -hover_height}});
TweenMax.to(hover_image_up, phi_delay, {css: {bottom: 0}});
},
mouseleave: function()
{
hover_height = hover_image_up.outerHeight();
TweenMax.to(img, phi_delay, {css: {top: 0}});
TweenMax.to(hover_image_up, phi_delay, {css: {bottom: -hover_height}});
}
});
});
// Post Thumbnauls Hover - Fade Hover (Blog 1 Column)
var post_images_2 = $(".post_entry .post_thumb:has(.fade_hover)"),
bpt_delay = 0.35,
bpt_direction = 1;
post_images_2.imagesLoaded(function(){
post_images_2.each(function()
{
var post_image = $(this);
var hover_el = post_image.find('.hover'),
hover_icons = hover_el.find('span'),
hover_move_top;
hover_move_top = post_image.height();
hover_el.css({visibility: 'visible', marginTop: bpt_direction * hover_move_top});
hover_icons.css({marginTop: -bpt_direction * hover_move_top * 1.8});
post_image.on({
mouseenter: function()
{
TweenMax.to(hover_el, bpt_delay, {css: {marginTop: 0}, ease: Sine.easeOut});
TweenMax.to(hover_icons, bpt_delay, {css: {marginTop: 0, ease: Sine.easeOut}});
},
mouseleave: function()
{
hover_move_top = post_image.height();
TweenMax.to(hover_el, bpt_delay, {css: {marginTop: bpt_direction * hover_move_top}});
TweenMax.to(hover_icons, bpt_delay, {css: {marginTop: -bpt_direction * hover_move_top * 1.8}});
}
});
});
});
// Gallery Thumbnails Hover
var album_images = $(".gallery .album .image:has(.hover_blank)"),
ai_delay = 0.3;
galleryAlbumHoverEffect(album_images, ai_delay);
// Gallery View Options
var gallery_container = $("#gallery_container");
$("#change_gallery_type").on('click', 'a', function(ev)
{
ev.preventDefault();
var $this = $(this),
view_type = $this.data('type');
$("#change_gallery_type a").removeClass('active');
$this.addClass('active');
gallery_container.removeClass('grid').removeClass('list').addClass(view_type);
if(typeof Cookies != 'undefined')
{
Cookies.set('gallery_' + gallery_container.data('id') + '_view_type', view_type);
}
// Relayout
gallery_container
.masonry( 'option', { columnWidth: (gallery_container.hasClass('list') ? 1/1 : 1/4), isAnimated: false } )
.masonry( 'reload' );
});
// Gallery Albums
if($.isFunction($.fn.masonry))
{
gallery_container.imagesLoaded(function(){
gallery_container.masonry({
columnWidth: gallery_container.hasClass('list') ? 1/1 : 1/4
});
});
}
/* Infinite Scroll for Gallery */
var endless_scrolling = jQuery(".endless_scrolling");
if(jQuery.isFunction(jQuery.fn.infinitescroll) && endless_scrolling.length > 0)
{
var pagination_link_gallery = jQuery('.endless_scroll_pagination_gallery a'),
child_class = '.album';
pagination_link_gallery.infinitescroll({
navSelector: pagination_link_gallery,
nextSelector: pagination_link_gallery,
itemSelector: child_class,
onIsDone: function(){
TweenMax.to(pagination_link, 0.5, {css: {autoAlpha: 0}});
},
loading: {
finishedMsg: '',
img: '',
msgText: ''
}
//,debug: true
},
function(newElements){
var new_items = jQuery(newElements);
galleryAlbumHoverEffect(new_items, ai_delay);
gallery_container.append(new_items).masonry('appended', new_items, function()
{
gallery_container.masonry( 'option', {isAnimated: true } ).masonry('reload');
});
});
}
/* Social Share */
if($.isFunction($.fn.socialShare))
{
var ss = $('.social-share');
ss.each(function()
{
var $this = $(this);
$this.socialShare({
social: $this.data('social'),
whenSelect: true,
selectContainer: '.social-share-env'
});
$this.on('click', function(ev)
{
ev.preventDefault();
});
});
}
/* ShadowBox */
if(typeof window.Shadowbox != 'undefined')
{
// Post Images Gallery
var post_gallery = jQuery(".full_post .gallery .gallery-item");
if(post_gallery.length > 0)
{
var post_gallery_id = jQuery(".blog_post .gallery").attr('id');
post_gallery.each(function()
{
var image = jQuery(this);
var image_link = image.find('.gallery-icon a');
var image_alt = image_link.find('img').attr('alt');
var caption = image.find('.gallery-caption').text();
// Detect Youtube
var matches;
if(image_alt.length && (matches = image_alt.match(/v=(\w+)/)))
{
var youtube_id = matches[1];
image_link.attr('href', 'http://www.youtube.com/v/' + youtube_id).attr('rel', 'width=700;height=450');
}
else
// Detect Vimeo
if(image_alt.length && (matches = image_alt.match(/vimeo\.com\/(\d+)/)))
{
var vimeo_id = matches[1];
image_link.attr('href', 'http://vimeo.com/moogaloop.swf?clip_id=' + vimeo_id).attr('rel', 'width=700;height=450');;
}
image_link.attr('rel', 'shadowbox['+post_gallery_id+'];' + image_link.attr('rel'));
image_link.attr('title', caption)
});
}
Shadowbox.init({
handleOversize: 'resize',
continuous: true
});
}
// Go Back Button
$(".go_back_portfolio").click(function(ev)
{
if(window.history.length > 1)
{
ev.preventDefault();
window.history.back();
}
})
})(jQuery, window);
/* Partners Caoursel */
function partnersCarouselFit()
{
var partners_carousel_instance = jQuery(".partners_carousel").data('ancarouselinstance');;
if(typeof partners_carousel_instance != 'undefined')
{
switch(test_device_type())
{
case "large_screen":
partners_carousel_instance.updateItemsPerRowNumber(4);
break;
case "ipad":
partners_carousel_instance.updateItemsPerRowNumber(3);
break;
case "iphone_landscape":
case "iphone":
partners_carousel_instance.updateItemsPerRowNumber(2);
break;
}
}
}
/* Gallery Album Hover Effect */
function galleryAlbumHoverEffect(album_images, ai_delay)
{
album_images.imagesLoaded(function()
{
album_images.each(function()
{
var $image = jQuery(this),
hover_blank = $image.find('.hover_blank'),
hover_w = hover_blank.outerWidth(),
hover_h = hover_blank.outerHeight();
hover_blank.css({
visibility: 'visible',
left: -hover_w,
bottom: -hover_h
});
$image.on({
mouseenter: function()
{
TweenMax.to(hover_blank, ai_delay, {css: {left: 0, bottom: 0}, ease: Expo.easeOut});
},
mouseleave: function()
{
hover_w = hover_blank.outerWidth();
hover_h = hover_blank.outerHeight();
TweenMax.to(hover_blank, ai_delay, {css: {left: -hover_w, bottom: -hover_h}, ease: Expo.easeIn});
}
});
});
});
}