blob: ffc4603fed81e54263302525bf5668a6936ac583 [file] [log] [blame]
jQuery(function($) {
"use strict";
// Author Code Here
var owlPricing;
var ratio = 2;
// Window Load
$(window).load(function() {
// Preloader
$('.parallax').css('opacity', '0');
$('.preloader').addClass('animated fadeOut').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() {
$('.preloader').hide();
$('.parallax').addClass('animated fadeIn').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() {
$('.intro-tables').addClass('animated fadeInUp').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend');
});
});
// Header Init
if ($(window).height() > $(window).width()) {
var ratio = $('.parallax').width() / $('.parallax').height();
$('.parallax img').css('height', ($(window).height()) + 'px');
$('.parallax img').css('width', $('.parallax').height() * ratio + 'px');
}
$('section .cut').each(function() {
if ($(this).hasClass('cut-top'))
$(this).css('border-right-width', $(this).parent().width() + "px");
else if ($(this).hasClass('cut-bottom'))
$(this).css('border-left-width', $(this).parent().width() + "px");
});
// Sliders Init
$('.owl-schedule').owlCarousel({
singleItem: true,
pagination: true
});
$('.owl-testimonials').owlCarousel({
singleItem: true,
pagination: true
});
$('.owl-twitter').owlCarousel({
singleItem: true,
pagination: true
});
// Navbar Init
$('nav').insertAfter('nav').addClass('navbar-fixed-top').css('position', 'fixed').css('top', '0').css('margin-top', '0').removeClass('original');
$('.mobile-nav ul').html($('nav .navbar-nav').html());
$('nav.navbar-fixed-top .navbar-brand img').attr('src', $('nav.navbar-fixed-top .navbar-brand img').data("active-url"));
// Typing Intro Init
$(".typed").typewriter({
speed: 60
});
// Popup Form Init
var i = 0;
var interval = 0.15;
$('.popup-form .dropdown-menu li').each(function() {
$(this).css('animation-delay', i + "s");
i += interval;
});
$('.popup-form .dropdown-menu li a').click(function(event) {
event.preventDefault();
$(this).parent().parent().prev('button').html($(this).html());
});
});
// Window Resize
var resizeContent = function() {
$('#main-block').css('min-height', $(window).height() - $('footer').height() - (40 + 60) /*header/footer padding*/);
};
$(window).resize(resizeContent);
resizeContent();
// Pricing Box Click Event
$('.pricing .box-main').click(function() {
$('.pricing .box-main').removeClass('active');
$('.pricing .box-second').removeClass('active');
$(this).addClass('active');
$(this).next($('.box-second')).addClass('active');
$('#pricing').css("background-image", "url(" + $(this).data('img') + ")");
$('#pricing').css("background-size", "cover");
});
// Mobile Nav
$('body').on('click', 'nav .navbar-toggle', function() {
event.stopPropagation();
$('.mobile-nav').addClass('active');
});
$('body').on('click', '.mobile-nav a', function(event) {
$('.mobile-nav').removeClass('active');
if(!this.hash) return;
event.preventDefault();
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
event.stopPropagation();
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
}
}
});
$('body').on('click', '.mobile-nav a.close-link', function(event) {
$('.mobile-nav').removeClass('active');
event.preventDefault();
});
$('body').on('click', 'nav.original .navbar-nav a:not([data-toggle])', function() {
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
event.stopPropagation();
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
}
}
});
function centerModal() {
$(this).css('display', 'block');
var $dialog = $(this).find(".modal-dialog"),
offset = ($(window).height() - $dialog.height()) / 2,
bottomMargin = parseInt($dialog.css('marginBottom'), 10);
// Make sure you don't hide the top part of the modal w/ a negative margin
// if it's longer than the screen height, and keep the margin equal to
// the bottom margin of the modal
if (offset < bottomMargin) offset = bottomMargin;
$dialog.css("margin-top", offset);
}
$('.modal').on('show.bs.modal', centerModal);
$('.modal-popup .close-link').click(function(event){
event.preventDefault();
$('#modal1').modal('hide');
});
$(window).on("resize", function() {
$('.modal:visible').each(centerModal);
});
$(document).ready(function() {
// if there is any file tree
$('#filetree').each(function (i , v) {
var self = $(this);
self.tree({
data: eval(self.find('p')[0].innerHTML),
closedIcon: $('<i class="fa fa-folder-o"</i>;'),
openedIcon: $('<i class="fa fa-folder-open-o"</i>')
});
self.bind(
'tree.click',
function(event) {
var node = event.node;
if (node.description) {$('#filetreedetail').html(node.description);}
}
);
});
// code snippet
$('pre code').each(function (i, block){
hljs.highlightBlock(block);
});
});
});