var window_height = $(window).height(),
testMobile,
loadingError = '
The Content cannot be loaded.
',
nameError = 'Please enter your name.
',
emailError = 'Please enter your e-mail address.
',
invalidEmailError = 'Please enter a valid e-mail address.
',
subjectError = 'Please enter the subject.
',
messageError = 'Please enter your message.
',
mailSuccess = 'Your message has been sent. Thank you!
',
mailResult = $('#contact .result'),
current,
next,
prev,
target,
hash,
url,
page,
title,
projectIndex,
scrollPostition,
projectLength,
ajaxLoading = false,
wrapperHeight,
pageRefresh = true,
content =false,
loader = $('div#loader'),
portfolioGrid = $('div#portfolio-wrap'),
projectContainer = $('div#ajax-content-inner'),
projectNav = $('#project-navigation ul'),
exitProject = $('div#closeProject a'),
easing = 'easeOutExpo',
folderName ='projects';
$.browser.safari = ($.browser.webkit && !(/chrome/.test(navigator.userAgent.toLowerCase())));
$('.home-slide').each(function(){
contentSize = $(this).find('.home-slide-content');
contentSize.fitText(1.2);
});
if ( $.browser.safari ) {
$('#home-slider').flexslider({
animation: "swing",
direction: "vertical",
slideshow: false,
slideshowSpeed: 3500,
animationDuration: 1000,
directionNav: false,
controlNav: true,
smootheHeight:true,
useCSS: false
});
}
if ( $.browser.safari ) {
$('.flexslider').flexslider({
animation: "slide",
direction: "horizontal",
slideshow: false,
slideshowSpeed: 3500,
animationDuration: 500,
directionNav: true,
controlNav: false,
useCSS: false
});
}
if ( !$.browser.safari ) {
$('.home-parallax, .home-gradient').find('.home-text-wrapper').children('.container').addClass('no-safari');
}
var init = function() {
$('nav').animate({'opacity': '1'}, 0);
// Function to slabtext the H1 headings
function slabTextHeadlines() {
$(".home-quote h1").slabText({
// Don't slabtext the headers if the viewport is under 479px
"viewportBreakpoint":300
});
};
$(window).load(function() {
setTimeout(slabTextHeadlines, 5);
});
/*----------------------------------------------------*/
/* FULLSCREEN IMAGE HEIGHT
/*----------------------------------------------------*/
function fullscreenImgHeight(){
/*height fixed and auto fixed*/
/*$('#home').css({height:window_height});*/
/* var headerH = $('nav').outerHeight();
$("#home").css('marginBottom',-headerH);*/
}
fullscreenImgHeight();
$(window).bind('resize',function() {
fullscreenImgHeight();
home_parallax();
});
};
jQuery(window).load(function(){
jQuery(document).ready(function($){
// cache container
var $container = $('#portfolio-wrap');
$.browser.safari = ($.browser.webkit && !(/chrome/.test(navigator.userAgent.toLowerCase())));
if($.browser.safari){
// initialize isotope
$container.isotope({
animationEngine : 'jquery',
animationOptions: {
duration: 200,
queue: false
},
layoutMode: 'fitRows'
});
} else {
$container.isotope({
animationEngine : 'best-available',
animationOptions: {
duration: 200,
queue: false
},
layoutMode: 'fitRows'
});
$(window).resize(function() {
$container.isotope('reLayout');
});
}
// filter items when filter link is clicked
$('#filters a').click(function(){
$('#filters a').removeClass('active');
$(this).addClass('active');
var selector = $(this).attr('data-filter');
$container.isotope({ filter: selector });
return false;
});
});
});
/*----------------------------------------------------*/
/* TWITTER CALLBACK FUNCTION
/*----------------------------------------------------*/
function twitterCall(twitters) {
var statusHTML = [];
for (var i=0; i]*[^.,;'">\:\s\<\>\)\]\!])/g, function(url) {
return ''+url+'';
}).replace(/\B@([_a-z0-9]+)/ig, function(reply) {
return ''+ reply.charAt(0) + reply.substring(1)+'';
}).replace(/\B#([_a-z0-9а-я]+)/ig, function(hashtag) {
return ''+hashtag+'';
});
statusHTML.push('');
}
document.getElementById('twitter-feed').innerHTML = statusHTML.join('');
}
function twitterBlogCall(twitters) {
var statusHTML = [];
for (var i=0; i]*[^.,;'">\:\s\<\>\)\]\!])/g, function(url) {
return ''+url+'';
}).replace(/\B@([_a-z0-9]+)/ig, function(reply) {
return ''+ reply.charAt(0) + reply.substring(1)+'';
}).replace(/\B#([_a-z0-9а-я]+)/ig, function(hashtag) {
return ''+hashtag+'';
});
statusHTML.push('');
}
document.getElementById('twitter-feed').innerHTML = statusHTML.join('');
}
/*----------------------------------------------------*/
/* RELATIVE TIME FUNCTION
/*----------------------------------------------------*/
function relative_time(time_value) {
var values = time_value.split(" ");
time_value = values[1] + " " + values[2] + ", " + values[5] + " " + values[3];
var parsed_date = Date.parse(time_value);
var relative_to = (arguments.length > 1) ? arguments[1] : new Date();
var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);
delta = delta + (relative_to.getTimezoneOffset() * 60);
if (delta < 60) {
return 'less than a minute ago';
} else if(delta < 120) {
return 'about a minute ago';
} else if(delta < (60*60)) {
return (parseInt(delta / 60)).toString() + ' minutes ago';
} else if(delta < (120*60)) {
return 'about an hour ago';
} else if(delta < (24*60*60)) {
return 'about ' + (parseInt(delta / 3600)).toString() + ' hours ago';
} else if(delta < (48*60*60)) {
return '1 day ago';
} else {
return (parseInt(delta / 86400)).toString() + ' days ago';
}
}
function home_parallax() {
$(window).scroll(function() {
var yPos = -($(window).scrollTop() / 0.7);
// Put together our final background position
var coords = '100% '+ yPos + 'px';
// Move the background
//$('.page-title-wrapper').css({ backgroundPosition: coords });
$('.home-parallax').css({ backgroundPosition: coords });
});
}
home_parallax();
/*----------------------------------------------------*/
/* MOBILE DETECT FUNCTION
/*----------------------------------------------------*/
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};
/*----------------------------------------------------*/
// CONTACT FORM WIDGET
/*----------------------------------------------------*/
$("#contact form").submit(function()
{
var form = $(this);
var formParams = form.serialize();
$.ajax(
{
url: 'contact.php',
type: 'POST',
traditional: true,
data: formParams,
success: function(data){
var response = jQuery.parseJSON(data);
$("#contact .result .alert").slideUp().remove();
if(response.success)
{ $('#contact form').slideUp().height('0');
$('#contact .result').append(mailSuccess);
}
else
{
for(i=0; i= loops) {
clearInterval(interval);
value = options.to;
if (typeof(options.onComplete) == 'function') {
options.onComplete.call(_this, value);
}
}
}
});
};
$.fn.countTo.defaults = {
from: 0, // the number the element should start at
to: 100, // the number the element should end at
speed: 1000, // how long it should take to count between the target numbers
refreshInterval: 100, // how often the element should be updated
decimals: 0, // the number of decimal places to show
onUpdate: null, // callback method for every time the element is updated,
onComplete: null, // callback method for when the element finishes updating
};
})(jQuery);