/*
theme name: topbiz - responsive corporate html5 template
theme url: http://themewar.com/html/topland
author: themewar
author uri: http://www.themewar.com
description: responsive corporate html5 template
version: 1.0
*/
(function ($) {
'use strict';
//========================
// loader
//========================
$(window).load(function () {
if ($(".loaderwrap").length > 0)
{
$(".loaderwrap").delay(500).fadeout("slow");
}
});
//========================
// pretty photo
//========================
if ($("a[data-rel^='prettyphoto']").length > 0) {
$("a[data-rel^='prettyphoto']").prettyphoto({
social_tools: false
});
}
//=======================================================
// gallery mixing
//=======================================================
if ($('#mixer').length > 0)
{
$('#mixer').themewar();
}
//=======================================================
// circle bar
//=======================================================
if ($('.singleskill').length > 0) {
$('.skillarea').appear(function () {
$(".cmskill").each(function () {
var pint = $(this).attr('data-skills');
var decs = pint * 100;
var grs = $(this).attr('data-gradientstart');
var gre = $(this).attr('data-gradientend');
$(this).circleprogress({
value: pint,
startangle: -math.pi / 4 * 2,
fill: {gradient: [[grs, 1], [gre, .2]], gradientangle: math.pi / 4 * 2},
linecap: 'round',
thickness: 22,
animation: {duration: 1800},
size: 270
}).on('circle-animation-progress', function (event, progress) {
$(this).find('strong').html(parseint(decs * progress) + '%');
});
});
});
}
//=======================================================
// portfolio hover
//=======================================================
if ($('.folioimg').length > 0) {
$(' .folioimg').each(function () {
$(this).hoverdir({
hoverdelay: 90
});
});
}
//=======================================================
// contact map
//=======================================================
if ($("#map").length > 0)
{
var map;
map = new gmaps({
el: '#map',
lat: 51.5224303,
lng: -0.15554,
scrollwheel: false,
zoom: 18,
zoomcontrol: false,
pancontrol: false,
streetviewcontrol: false,
maptypecontrol: false,
overviewmapcontrol: false,
clickable: false
});
}
//=======================================================
// home slider
//=======================================================
if ($(".sliderarea").length > 0)
{
var revs;
revs = $('.tp-banner1').revolution({
delay: 6000,
startheight: 656,
startwidth: 1170,
hidethumbs: 200,
thumbwidth: 100,
thumbheight: 50,
thumbamount: 5,
navigationtype: "bullet",
navigationarrows: "none",
navigationstyle: "round",
touchenabled: "on",
onhoverstop: "on",
navoffsethorizontal: 0,
navoffsetvertical: 20,
shadow: 0,
fullwidth: "on",
fullscreen: "on"
});
revs.bind("revolution.slide.onchange", function (e, data) {
$(".sliderarea").attr('data-currentslide', 'activrev_' + data.slideindex);
});
}
//=======================================================
// mobile menu
//=======================================================
$(".menubutton").on('click', function () {
$(".mainmenu > ul").slidetoggle('slow');
$(this).toggleclass('active');
});
if ($(window).width() <= 991)
{
$("ul li.haschild > a").on('click', function (e) {
e.preventdefault();
$(this).next('.dropsub').slidetoggle('slow');
$(this).next('.dropmenu').slidetoggle('slow');
});
}
$(".menubutton").on('click', function () {
$(".innermenu > ul").slidetoggle('slow');
$(this).toggleclass('active');
});
//=======================================================
// color preset
//=======================================================
if ($(".presetarea").length > 0)
{
var switchs = true;
$("#switches").on('click', function (e) {
e.preventdefault();
if (switchs)
{
$(this).addclass('active');
$(".presetarea").animate({'left': '0px'}, 400);
switchs = false;
}
else
{
$(this).removeclass('active');
$(".presetarea").animate({'left': '-290px'}, 400);
switchs = true;
}
});
$(".patterns a").on('click', function (e) {
e.preventdefault();
var bg = $(this).attr('href');
if ($("#boxlayout").hasclass('active'))
{
//alert(bg);
$('.patterns a').removeclass('active');
$(this).addclass('active');
$('body').removeclass('bgone bgtwo bgthree bgfour bgfive');
$('body').addclass(bg);
}
else
{
alert('please, active box layout first.');
}
});
$(".layouta").on('click', function (e) {
e.preventdefault();
var layout = $(this).attr('href');
if (layout == 'wide')
{
$('body').removeclass('bgone bgtwo bgthree bgfour bgfive');
}
$('.layouta').removeclass('active');
$(this).addclass('active');
$("#layout").attr('href', 'css/colorpreset/' + layout + '.css');
});
$(".colorchem a").click(function (e) {
e.preventdefault();
var colorsch = $(this).attr('href');
$('.colorchem a').removeclass('active');
$(this).addclass('active');
$("#colorchem").attr('href', 'css/colorpreset/' + colorsch + '.css');
});
$(".accentcolor a").click(function (e) {
e.preventdefault();
var color = $(this).attr('href');
$(".accentcolor a").removeclass('active');
$(this).addclass('active');
$("#colorsset").attr('href', 'css/colorpreset/' + color + '.css');
});
}
//=======================================================
// fixed header
//=======================================================
if ($(".headerarea").length > 0)
{
$(window).on('scroll', function () {
if ($(window).scrolltop() > 500)
{
$(".headerarea").addclass('headerfix animated fadeinup1');
}
else
{
$(".headerarea").removeclass('headerfix animated fadeinup1');
}
});
}
else
{
$(window).on('scroll', function () {
if ($(window).scrolltop() > 170)
{
$(".headerarea").addclass('headerfix animated fadeinup1');
}
else
{
$(".headerarea").removeclass('headerfix animated fadeinup1');
}
});
}
//========================================================
// fun fact
//========================================================
$('.funfactarea').appear(function () {
$('.mycounter').each(function () {
var $this = $(this);
jquery({counter: 0}).animate({counter: $this.attr('data-counter')}, {
duration: 6000,
easing: 'swing',
step: function () {
var num = math.ceil(this.counter).tostring();
if (number(num) > 999) {
while (/(\d+)(\d{3})/.test(num)) {
num = num.replace(/(\d+)(\d{3})/, '' + '$1' + '' + '$2');
}
}
$this.html(num);
}
});
});
});
//========================================================
// subscribe form
//========================================================
if ($("#subscribeform").length > 0)
{
$("#subscribeform").submit(function (e) {
e.preventdefault();
$("button i", this).removeclass('icon-pencil').addclass('fa fa-spinner fa-spin');
var email = $("#subs_email").val();
if (email !== '')
{
$("#subs_email").removeclass('errorinput');
$.ajax({
type: "post",
url: 'subscribe.php',
data: {email: email},
success: function (data)
{
$("#subs_email").val('');
$("#subs_email").attr('placeholder', 'successfully done!');
$("#subs_email").addclass('successinput');
$("#subscribeform button i").removeclass('fa fa-spinner fa-spin').addclass('icon-pen2');
}
});
}
else
{
$("#subs_email").addclass('errorinput');
$("button i", this).removeclass('fa fa-spinner fa-spin').addclass('icon-pen2');
}
return false;
});
}
//========================================================
// contact
//========================================================
if ($("#uncontactform").length > 0)
{
$("#uncontactform").on('submit', function (e) {
e.preventdefault();
var alldata = $(this).serialize();
var required = 0;
$("#unconsubmit").html('sending...');
$(".required", this).each(function () {
if ($(this).val() == '')
{
$(this).addclass('reqerror');
required += 1;
}
else
{
if ($(this).hasclass('reqerror'))
{
$(this).removeclass('reqerror');
if (required > 0)
{
required -= 1;
}
}
}
});
//alert(required);
if (required === 0)
{
$("#unconsubmit").html('sending...');
$.ajax({
type: "post",
url: 'contact_mail.php',
data: {alldata: alldata},
success: function (data)
{
$("#uncontactform input[type='text'], #uncontactform input[type='email'], #uncontactform textarea").val('');
$("#unconsubmit").html('done!');
}
});
}
else
{
$("#unconsubmit").html('send');
}
});
}
//========================
// back to top
//========================
if ($("#backto").length > 0)
{
$("#backto").on('click', function (e) {
e.preventdefault();
$('html, body').animate({scrolltop: 0}, 1000);
});
}
//========================
// wow init
//========================
if ($(window).width() > 490)
{
var wow = new wow({
mobile: false
});
wow.init();
}
//========================
// image carousel
//========================
if ($(".caroselarea").length > 0)
{
// home page slider
$('.imagecaros').slick({
centermode: true,
centerpadding: '80px',
slidestoshow: 3,
autoplay: true,
autoplayspeed: 5000,
responsive: [
{
breakpoint: 1024,
settings: {
slidestoshow: 3,
slidestoscroll: 3,
infinite: true
}
},
{
breakpoint: 600,
settings: {
slidestoshow: 2,
slidestoscroll: 2
}
},
{
breakpoint: 480,
settings: {
slidestoshow: 1,
slidestoscroll: 1
}
}
]
});
}
})(jquery);