(function ($) {
"use strict";
/**
* Theme Name: Bring Back
* File Name: Bring Back Main jQuery File
* Description: All Custom Functionality of the theme and external plugins active for here.
* Author: bringback
* Version: 1.0
*/
// Document
$(document).ready( function ($) {
// Testimonial Slider
if ( $.fn.slick ) {
$( '.testimonial-slider' ).slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: true,
dots: false,
prevArrow: '
',
nextArrow: '
',
asNavFor: '.testimonial-nav-slider',
});
}
// Testimonial Nav Slider
if ( $.fn.slick ) {
$( '.testimonial-nav-slider' ).slick({
slidesToShow: 5,
slidesToScroll: 1,
infinite: true,
asNavFor: '.testimonial-slider',
dots: false,
arrows: false,
centerMode: true,
centerPadding: '0',
focusOnSelect: false,
accessibility: false,
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
infinite: true,
dots: false,
arrows: false
}
},
{
breakpoint: 600,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
infinite: true,
dots: false,
arrows: false
}
},
{
breakpoint: 480,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
infinite: true,
dots: false,
arrows: false
}
}
]
});
}
// Pricing slider
if ( $.fn.slick ) {
$( '.pricing-slider' ).slick({
slidesToShow: 1,
autoplay: false,
slidesToScroll: 1,
infinite: true,
arrows: true,
dots: false,
centerMode: true,
prevArrow: '
',
nextArrow: '
',
centerPadding: '150px',
focusOnSelect: false,
accessibility: false,
responsive: [
{
breakpoint: 1200,
settings: {
centerPadding: '50px',
}
},
{
breakpoint: 600,
settings: {
centerPadding: '30px',
}
},
{
breakpoint: 480,
settings: {
centerPadding: '30px',
}
}
]
});
}
// Mobile Menu
$( '.main-menu .dropdown a i' ).on( 'click', function ( e ) {
e.preventDefault();
$( this ).parents( 'li' ).find( '.dropdown-menu' ).slideToggle();
});
// Footer Menu SlideToggle for mobile
$( 'body' ).on( 'click', '.footer h4 > span' , function () {
$( this ).parent( 'h4' ).next().slideToggle();
});
// First
$('.nav-tabs a:first').tab('show')
// Get the form.
var form = $('.ajax-contact');
// Get the messages div.
var formMessages = $('.form-messages');
// Set up an event listener for the contact form.
$(form).submit(function(event) {
// Stop the browser from submitting the form.
event.preventDefault();
var formData = $(form).serialize();
// Submit the form using AJAX.
$.ajax({
type: 'POST',
url: $(form).attr('action'),
data: formData
}).done(function(response) {
// Make sure that the formMessages div has the 'success' class.
$(formMessages).removeClass('form-error mb-4');
$(formMessages).addClass('form-success mb-4');
// Set the message text.
$(formMessages).text(response);
// Clear the form.
$('.form-control').val('');
}).fail(function(data) {
// Make sure that the formMessages div has the 'error' class.
$(formMessages).removeClass('form-success mb-4');
$(formMessages).addClass('form-error mb-4');
// Set the message text.
if (data.responseText !== '') {
$(formMessages).text(data.responseText);
} else {
$(formMessages).text('Oops! An error occured and your message could not be sent.');
}
});
});
});
// Window
$(window).on('load', function () {
// Init Wow JS
new WOW().init();
// Google Map
if( $( "#map" ).length > 0 ) {
var mapOptions = {
zoom: 8,
disableDefaultUI: true,
center: new google.maps.LatLng(39.6351518, -79.9784847),
styles: [
{
"featureType": "administrative",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#444444"
}
]
},
{
"featureType": "landscape",
"elementType": "all",
"stylers": [
{
"color": "#f2f2f2"
}
]
},
{
"featureType": "poi",
"elementType": "all",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "road",
"elementType": "all",
"stylers": [
{
"saturation": -100
},
{
"lightness": 45
}
]
},
{
"featureType": "road.highway",
"elementType": "all",
"stylers": [
{
"visibility": "simplified"
}
]
},
{
"featureType": "road.arterial",
"elementType": "labels.icon",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "transit",
"elementType": "all",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "water",
"elementType": "all",
"stylers": [
{
"color": "#fc802a"
},
{
"visibility": "on"
}
]
}
]
},
mapElement = document.getElementById('map'),
map = new google.maps.Map(mapElement, mapOptions),
marker = new google.maps.Marker({
position: new google.maps.LatLng(39.6351518, -79.9784847),
map: map,
icon: 'images/contact/map-maker.png',
title: 'Snazzy!'
});
}
// Preloader
$( '#preloader' ).fadeOut('slow', function () {
$( this ).hide();
});
});
}(jQuery));