var $ = jQuery.noConflict();
//TOGGLE-------------------------------------------------------
$(document).ready(function () {
$('#toggle-view li').click(function () {
var text = $(this).children('div.panel');
if (text.is(':hidden')) {
text.slideDown('10');
$(this).children('.ui-accordion-header').addClass('ui-accordion-header-active');
} else {
text.slideUp('10');
$(this).children('.ui-accordion-header').removeClass('ui-accordion-header-active');
}
});
});
//ACCORDION-----------------------------------------------------
$(document).ready(function() {
$("#accordion").accordion({
autoHeight: false,
});
});
//DROPDOWN MENU--------------------------------------------------
$(document).ready(function(){
$('ul.sf-menu').superfish({
autoArrows: false,
dropShadows: false
});
});
//ADAPTIVE MENU--------------------------------------------------
$(document).ready(function(){
// add select
$('').appendTo('nav#main-nav');
//add options to select
$('', {
'selected': 'selected',
'value' : '',
'text': 'Choose Page...'
}).appendTo('nav select');
$('nav#main-nav ul li a').each(function(){
var target = $(this);
$('', {
'value' : target.attr('href'),
'text': target.text()
}).appendTo('nav#main-nav select');
});
// onclicking
$('nav#main-nav select').on('change',function(){
window.location = $(this).find('option:selected').val();
});
});
//FANCYBOX-------------------------------------------------------
$(document).ready(function() {
$(".lightbox").live("mousedown", function()
{
$(this).fancybox(
{
'titleShow' : false,
'overlayShow' : false,
'transitionIn' : 'elastic',
'transitionOut' : 'elastic'
});
});
$("a.iframe").fancybox(
{
'titleShow' : true,
'autoDimensions' : true,
'width' : 900,
'height' : 600,
'autoScale' : true,
'type' : 'iframe'
});
$(".iframe a").fancybox(
{
'titleShow' : true,
'autoDimensions' : true,
'width' : 900,
'height' : 600,
'autoScale' : true,
'type' : 'iframe'
});
});
//PORTFOLIO FILTER------------------------------------------------
$(document).ready(function(){
// Clone portfolio items to get a second collection for Quicksand plugin
var $portfolioClone = $("#portfolio").clone();
// Attempt to call Quicksand on every click event handler
$("#filter a").click(function(e){
$("#filter li").removeClass("current");
// Get the class attribute value of the clicked link
var $filterClass = $(this).parent().attr("class");
if ( $filterClass == "all" ) {
var $filteredPortfolio = $portfolioClone.find("li");
} else {
var $filteredPortfolio = $portfolioClone.find("li[data-type~=" + $filterClass + "]");
}
// Call quicksand
$("#portfolio").quicksand( $filteredPortfolio, {
duration: 800,
easing: 'swing'
});
$(this).parent().addClass("current");
})
});
//CONTENT TABS---------------------------------------------------
$(document).ready(function() {
var $tabsNav = $('.tabs-nav'),
$tabsNavLis = $tabsNav.children('li'),
$tabContent = $('.tab-content');
$tabsNav.each(function() {
var $this = $(this);
$this.next().children('.tab-content').stop(true,true).hide()
.first().show();
$this.children('li').first().addClass('active').stop(true,true).show();
});
$tabsNavLis.on('click', function(e) {
var $this = $(this);
$this.siblings().removeClass('active').end()
.addClass('active');
$this.parent().next().children('.tab-content').stop(true,true).hide()
.siblings( $this.find('a').attr('href') ).fadeIn();
e.preventDefault();
});
});
//SCROLL TO TOP----------------------------------------------------
$(document).ready(function(){
// hide #back-top first
$("#back-top").hide();
// fade in #back-top
$(function () {
$(window).scroll(function () {
if ($(this).scrollTop() > 100) {
$('#back-top').fadeIn();
} else {
$('#back-top').fadeOut();
}
});
// scroll body to 0px on click
$('#back-top a').click(function () {
$('body,html').animate({
scrollTop: 0
}, 600);
return false;
});
});
});
//BLACK & WHITE HOVER EFFECT--------------------------------------
//$(window).load(function(){
// $('.bw-wrapper').BlackAndWhite({
// hoverEffect : true, // default true
// speed: { //this property could also be just speed: value for both fadeIn and fadeOut
// fadeIn: 200, // 200ms for fadeIn animations
// fadeOut: 300 // 800ms for fadeOut animations
// }
// });
//});
setTimeout(function(){
$('.skill-bar .skill-bar-content').each(function() {
var me = $(this);
var perc = me.attr("data-percentage");
var current_perc = 0;
var progress = setInterval(function() {
if (current_perc>=perc) {
clearInterval(progress);
} else {
current_perc +=1;
me.css('width', (current_perc)+'%');
}
me.text((current_perc)+'%');
}, 8);
});
},8);
//CAROUSEL--------------------------------------------------------
(function($){
$(document).ready(function(){
// Add classes for other carousels
var $carousel = $('.latest-work-jc, .latest-posts-jc, .testimonials-jc');
var scrollCount;
function adjustScrollCount() {
if( $(window).width() < 768 ) {
scrollCount = 1;
} else {
scrollCount = 1;
}
}
function adjustCarouselHeight() {
$carousel.each(function() {
var $this = $(this);
var maxHeight = -1;
$this.find('li').each(function() {
maxHeight = maxHeight > $(this).height() ? maxHeight : $(this).height();
});
$this.height(maxHeight);
});
}
function initCarousel() {
adjustCarouselHeight();
adjustScrollCount();
var i = 0;
var g = {};
$carousel.each(function() {
i++;
var $this = $(this);
g[i] = $this.jcarousel({
animation : 500,
scroll : scrollCount,
wrap: 'circular'
});
$this.jcarousel('scroll', 0);
$this.prev().find('.jcarousel-prev').bind('active.jcarouselcontrol', function() {
$(this).addClass('active');
}).bind('inactive.jcarouselcontrol', function() {
$(this).removeClass('active');
}).jcarouselControl({
target: '-='+scrollCount,
carousel: g[i]
});
$this.prev().find('.jcarousel-next').bind('active.jcarouselcontrol', function() {
$(this).addClass('active');
}).bind('inactive.jcarouselcontrol', function() {
$(this).removeClass('active');
}).jcarouselControl({
target: '+='+scrollCount,
carousel: g[i]
});
$this.touchwipe({
wipeLeft: function() {
$this.jcarousel('scroll','+='+scrollCount);
},
wipeRight: function() {
$this.jcarousel('scroll','-='+scrollCount);
}
});
});
}
$(window).load(function(){
initCarousel();
});
$(window).resize(function () {
$carousel.each(function() {
var $this = $(this);
$this.jcarousel('destroy');
});
initCarousel();
});
});
})(this.jQuery);
(function($){$.fn.touchwipe=function(settings){var config={min_move_x:20,min_move_y:20,wipeLeft:function(){},wipeRight:function(){},wipeUp:function(){},wipeDown:function(){},preventDefaultEvents:true};if(settings)$.extend(config,settings);this.each(function(){var startX;var startY;var isMoving=false;function cancelTouch(){this.removeEventListener('touchmove',onTouchMove);startX=null;isMoving=false}function onTouchMove(e){if(config.preventDefaultEvents){e.preventDefault()}if(isMoving){var x=e.touches[0].pageX;var y=e.touches[0].pageY;var dx=startX-x;var dy=startY-y;if(Math.abs(dx)>=config.min_move_x){cancelTouch();if(dx>0){config.wipeLeft()}else{config.wipeRight()}}else if(Math.abs(dy)>=config.min_move_y){cancelTouch();if(dy>0){config.wipeDown()}else{config.wipeUp()}}}}function onTouchStart(e){if(e.touches.length==1){startX=e.touches[0].pageX;startY=e.touches[0].pageY;isMoving=true;this.addEventListener('touchmove',onTouchMove,false)}}if('ontouchstart'in document.documentElement){this.addEventListener('touchstart',onTouchStart,false)}});return this}})(jQuery);
(function($){
$.fn.shuffle = function() {
var allElems = this.get(),
getRandom = function(max) {
return Math.floor(Math.random() * max);
},
shuffled = $.map(allElems, function(){
var random = getRandom(allElems.length),
randEl = $(allElems[random]).clone(true)[0];
allElems.splice(random, 1);
return randEl;
});
this.each(function(i){
$(this).replaceWith($(shuffled[i]));
});
return $(shuffled);
};
})(jQuery);