File: /home/imensosw/www/imenso.co/demo/diy/js/main.js
/*global $:false */
$(document).ready(function() {'use strict';
var $filter;
var $container;
var $containerClone;
var $filterLink;
var $filteredItems;
$filter = $('.filter li.active a').attr('class');
$filterLink = $('#filter li a');
$container = $('ul.filterable-grid');
$containerClone = $container.clone();
$('ul.filter>li a').click(function(event)
{
event.preventDefault();
$('ul.filter li').removeClass('active');
$filter = $(this).attr('class').split(' ');
$(this).parent().addClass('active');
if ($filter == 'all') {
$filteredItems = $containerClone.find('li');
}
else {
$filteredItems = $containerClone.find('li[data-type~=' + $filter + ']');
}
$('ul.filterable-grid').quicksand($filteredItems,
function () {
'use strict';
lightbox();
}
);
});
function lightbox() {
'use strict';
$("a[data-rel^='prettyPhoto']").prettyPhoto({
animationSpeed:'fast',
slideshow:5000,
theme:'pp_default',
show_title:false,
overlay_gallery: false,
social_tools: false
});
}
if($.prettyPhoto) {
lightbox();
}
});
/*global $:false */
/* ===== Backstretch Slider ===== */
$(document).ready(function() {'use strict';
var width = $(window).width();
var height = $(window).height();
$('#banner').css('height',height);
$('#banner').backstretch([
"images/bg_images.jpg",
"images/bg_images_2.jpg"
], {duration: 3000, fade: 750});
});
/*global $:false */
/* ===== Accordion Function ===== */
$(document).ready(function() {'use strict';
$('.toggle-title a').click(function(event){
event.isDefaultPrevented();
var name = $(this).attr('name');
var allTab = $('.skill-desc-box .toggole-content').hide();
allTab.slideUp('slow');
$('.toggle-title').removeClass('change-image');
$('#'+name).slideDown('slow');
$(this).parent().toggleClass('change-image');
'use strict';
return false;
});
});
/*global $:false */
/* ===== Progress Bar ===== */
$(document).ready(function() {'use strict';
$('.progress-bar').each(function(){
var data_left = $(this).data('value');
$(this).css('left',data_left+'%');
});
});
/*global $:false */
/* ====== Service tab ======= */
$(document).ready(function() {'use strict';
var width = $(window).width();
$('ul.tabs').each(function(){
'use strict';
// For each set of tabs, we want to keep track of
// which tab is active and it's associated content
var $active, $content, $links = $(this).find('a');
var width = $(window).width();
// If the location.hash matches one of the links, use that as the active tab.
// If no match is found, use the first link as the initial active tab.
$active = $($links.filter('[href="'+location.hash+'"]')[0] || $links[0]);
if(width > 767){
$active.addClass('active');
}else{
$active.addClass('activec');
}
$content = $($active.attr('href'));
// Hide the remaining content
$links.not($active).each(function () {
$($(this).attr('href')).hide();
});
// Bind the click event handler
$(this).on('click', 'a', function(event){
// Make the old tab inactive.
if(width > 767){
$active.removeClass('active');
}else{
$active.removeClass('activec');
}
$content.hide();
// Update the variables with the new link and content
$active = $(this);
$content = $($(this).attr('href'));
// Make the tab active.
if(width > 767){
$active.addClass('active');
}else{
$active.addClass('activec');
}
$content.show();
// Prevent the anchor's default click action
event.preventDefault();
});
});
});
/*global $:false */
/* =======Testimonial====== */
$(document).ready(function() {'use strict';
var width = $(window).width();
if(width > 480 && width < 750 ){
$('.sl-testimonial').bxSlider({minSlides: 1,
maxSlides: 1,
slideWidth: 480,
slideMargin: 0,
pager:false
});
}
if(width < 481){
$('.sl-testimonial').bxSlider({
minSlides: 1,
maxSlides: 1,
slideWidth: 265,
slideMargin: 15,
pager:false
});
}
if(width > 750 && width < 935){
$('.sl-testimonial').bxSlider({
minSlides: 1,
maxSlides: 2,
slideWidth: 355,
slideMargin: 0,
pager:false
});
}
if(width > 935){
$('.sl-testimonial').bxSlider({
minSlides: 1,
maxSlides: 3,
slideWidth: 300,
slideMargin: 20,
pager:false
});
}
if(width > 935){
$('.team-slider').bxSlider({
minSlides: 2,
maxSlides: 5,
slideWidth: 140,
slideMargin: 20,
pager:false
});
}
if (width > 750 && width < 935) {
$('.team-slider').bxSlider({
minSlides: 2,
maxSlides: 4,
slideWidth: 140,
slideMargin: 37,
pager:false
});
}
if(width < 750){
$('.team-slider').bxSlider({
minSlides: 2,
maxSlides: 3,
slideWidth: 140,
slideMargin: 10,
pager:false
});
}
});
/*global $:false */
$(document).ready(function() {'use strict';
/* ============== Navigation ========= */
$(".navigation .scroll").click(function(event){
event.preventDefault();
var full_url = this.href;
var parts = full_url.split("#");
var trgt = parts[1];
var target_offset = $("#"+trgt).offset();
var target_top = target_offset.top;
$('html, body').animate({scrollTop:target_top}, 900);
});
});
/*global $:false */
$(document).ready(function() {'use strict';
$(".scroll.siteLogo").click(function(event){
event.preventDefault();
var full_url = this.href;
var parts = full_url.split("#");
var trgt = parts[1];
var target_offset = $("#"+trgt).offset();
var target_top = target_offset.top;
$('html, body').animate({scrollTop:target_top}, 900);
});
});
/*global $:false */
$(document).ready(function() {'use strict';
$(".phone-menu .scroll").click(function(event){
event.preventDefault();
$('.phone-menu').slideToggle(600);
var full_url = this.href;
var parts = full_url.split("#");
var trgt = parts[1];
var target_offset = $("#"+trgt).offset();
var target_top = target_offset.top;
$('html, body').animate({scrollTop:target_top}, 900);
});
});
/*global $:false */
$(document).ready(function() {'use strict';
/* ============== Navigation Sticky ========= */
var stickyNavTop = $('#main-nav').offset().top;
var stickyNav = function(){
'use strict';
var scrollTop = $(window).scrollTop();
if(scrollTop > stickyNavTop) {
$('#main-nav').addClass('sticky');
} else {
$('#main-nav').removeClass('sticky');
}
};
stickyNav();
// and run it again every time you scroll
$(window).scroll(function() {
stickyNav();
});
});
/*global $:false */
$(document).ready(function() {'use strict';
$('.navigation').onePageNav();
$('.nav-toggole').click(function(){
$('.phone-menu').slideToggle(600);
});
});
/* ======== Window Resize ===== */
/*global $:false */
$(document).ready(function() {'use strict';
$(window).resize(function(){
// update some things on resize (and after 200 milliseconds of that)
if ( !$('html').hasClass('lt-ie9') ){
$.doTimeout('resize', 200, function(){
'use strict';
var width = $(window).width();
if(width > 480 && width < 750 ){
$('.sl-testimonial').bxSlider({
minSlides: 1,
maxSlides: 1,
slideWidth: 480,
slideMargin: 0,
pager:false
});
}
if(width < 481){
$('.sl-testimonial').bxSlider({
minSlides: 1,
maxSlides: 1,
slideWidth: 265,
slideMargin: 15,
pager:false
});
}
if(width > 750 && width < 935){
$('.sl-testimonial').bxSlider({
minSlides: 1,
maxSlides: 2,
slideWidth: 355,
slideMargin: 0,
pager:false
});
}
if(width > 935){
$('.sl-testimonial').bxSlider({
minSlides: 1,
maxSlides: 3,
slideWidth: 300,
slideMargin: 20,
pager:false
});
}
});
}
});
});
/*global $:false */
$(document).ready(function ($) {'use strict';
$('#formSubmit').click(function(){
'use strict';
var error = false;
var name = $('input#formName').val();
if(name === "" || name === " ") {
$('#error-name').fadeIn('slow');
error = true;
}else{
$('#error-name').fadeOut('slow');
}
var email_compare = /^([a-z0-9_.-]+)@([da-z.-]+).([a-z.]{2,6})$/;
var email = $('input#formEmail').val();
if (email === "" || email === " ") {
$('#error-email').fadeIn('slow');
error = true;
}else if (!email_compare.test(email)) {
$('#error-email').fadeIn('slow');
error = true;
}else{
$('#error-email').fadeOut('slow');
}
var message = $('textarea#message').val();
if(message === "" || message === " ") {
$('#error-sms').fadeIn('slow');
error = true;
}else{
$('#error-sms').fadeOut('slow');
}
if(error === false){
$.post("mail.php", $("#contactForm").serialize(),function(result){
if(result === 'sent'){
$('#contactForm').slideUp('slow');
$('#success').slideDown('slow');
}else{
$('#failed').fadeIn('slow');
}
});
}
'use strict';
return false;
});
});;