'use strict';
/* Smooth Scroll to Anchor on Different Page (Must Be At Top) */
$('html').css({display: 'none'});
$(document).ready(function(){
var hashURL = location.hash;
if(hashURL != '' && hashURL.length > 1){
$('html, body').scrollTop(0);
$('html').css({display: 'block'});
smoothScrollTo(hashURL);
} else {
$('html').css({display: 'block'});
}
});
/* Smooth Scroll to Anchor on Page Load */
function smoothScrollTo(anchor) {
var duration = 3000; //time (milliseconds) it takes to reach anchor point
var targetY = $(anchor).offset().top -85;
$("html, body").animate({
"scrollTop" : targetY
}, duration, 'easeInOutCubic');
}
/* Page Loader */
$(window).load(function() {
$(".loader").fadeOut("slow");
});
/* Reload Page on Orientation Change */
var supportsOrientationChange = "onorientationchange" in window,
orientationEvent = supportsOrientationChange ? "orientationchange" : "resize";
window.addEventListener(orientationEvent, function(){
window.location.reload()
}, false);
/* Display Mobile Menu */
$('
').insertBefore('#pages-list');
/* Toggle Mobile Menu */
$(document).ready(function(){
$("#menu-button-container").click(function(){
$("#pages-list").slideToggle();
$("#menu-button-container").toggleClass("active");
});
});
/* Close Mobile Menu When Link is Clicked */
if($(window).width() <= 1020){
$(document).ready(function($) {
$('#pages-list li a').on('click', function(){
$("#pages-list").slideToggle();
$("#menu-button-container").removeClass("active");
});
});
}
/* Wrap Top Bar Elements in Container */
$('#header, #lower_bar').wrapAll('
');
/* Accordion Script */
$(document).ready(function($) {
$('.accordion').find('.accordion-toggle').click(function(){
//Expand or collapse this panel
$(this).next().slideToggle('fast');
//Toggle active class
$(this).toggleClass("active");
//Hide the other panels
$(".accordion-content").not($(this).next()).slideUp('fast');
//Remove active class
$(".accordion").find(".active").not($(this)).removeClass("active");
});
});
/* Window Scroll Function */
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll >= 1) {
$(".navigation").addClass("scroll");
} else {
$(".navigation").removeClass("scroll");
}
});
/* Add Social Buttons to Navigation */
$('
').insertBefore('#pages-list > li:last-child');
/* Change Link for Order Button in Navigation */
$('#pages-list > li:last-child > a').replaceWith('Get Started');
/* Window Height to Equal Viewport Height */
var vHeight = $(window).height(),
cover = $('#home');
cover.css({"height":vHeight});
/* Scroll to Page Anchor */
$(function(){
$('a[href*="#"]:not([href="#"])').click(function() {
var target = $(this.hash);
var offset = -85;
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html, body').animate({
scrollTop: target.offset().top + offset
}, 1000);
return false;
}
});
});
/* Add Active Navigation Class on Scroll */
(function($) {
$(document).ready(function() {
var navChildren = $("#pages-list li").children();
var aArray = [];
for (var i = 0; i < navChildren.length; i++) {
var aChild = navChildren[i];
var ahref = $(aChild).attr('href');
aArray.push(ahref);
}
$(window).scroll(function() {
var windowPos = $(window).scrollTop();
var windowHeight = $(window).height();
var docHeight = $(document).height();
for (var i = 0; i < aArray.length; i++) {
var theID = aArray[i];
var secPosition = $(theID).offset().top;
secPosition = secPosition - 88;
var divHeight = $(theID).height();
divHeight = divHeight + 0;
if (windowPos >= secPosition && windowPos < (secPosition + divHeight)) {
$("a[href='" + theID + "']").parent().addClass("active");
} else {
$("a[href='" + theID + "']").parent().removeClass("active");
}
}
});
});
})(jQuery);
/* Add Circle Shapes to Home & Title Container
$('
').prependTo('#home, #title_container'); */
/* Add Product H1 & Breadcrumb to Title Container */
$( "#product_top > h1, #product_top > .breadcrumb, #content > h1, #content > .breadcrumb, #main > h1, #main > .breadcrumb" ).prependTo( "#title_container .title" );
/* Wrap First Word in H1 in Span Tag */
$('#title_container h1').each(function(){
var featureTitle = $(this);
featureTitle.html( featureTitle.text().replace(/(^\w+)/,'$1') );
});
/* Add Contact Form to Footer */
$("#form_32").appendTo(".contact-form");
/* Add Placeholders to Contact Form */
$('#f_id_5').each(
function(i,el) {
if (!el.value || el.value == '') {
el.placeholder = 'Name';
}
});
$('#f_id_6').each(
function(i,el) {
if (!el.value || el.value == '') {
el.placeholder = 'Phone or Email';
}
});
$('#f_id_7').each(
function(i,el) {
if (!el.value || el.value == '') {
el.placeholder = 'Message';
}
});
/* Add Placeholders to Newsletter Form */
$('#newsletter_email').each(
function(i,el) {
if (!el.value || el.value == '') {
el.placeholder = 'Enter Your Email';
}
});
/* Add Placeholders to Order Form */
$('#per_2').each(
function(i,el) {
if (!el.value || el.value == '') {
el.placeholder = 'Full Name *';
}
});
$('#per_1').each(
function(i,el) {
if (!el.value || el.value == '') {
el.placeholder = 'Job Title(s) *';
}
});
$('#per_16').each(
function(i,el) {
if (!el.value || el.value == '') {
el.placeholder = 'Address *';
}
});
$('#per_3').each(
function(i,el) {
if (!el.value || el.value == '') {
el.placeholder = 'Phone(s) *';
}
});
$('#per_4').each(
function(i,el) {
if (!el.value || el.value == '') {
el.placeholder = 'Email *';
}
});
$('#per_6').each(
function(i,el) {
if (!el.value || el.value == '') {
el.placeholder = 'Website(s)';
}
});
$('#per_10').each(
function(i,el) {
if (!el.value || el.value == '') {
el.placeholder = 'linkedin.com/yourprofile';
}
});
$('#per_8').each(
function(i,el) {
if (!el.value || el.value == '') {
el.placeholder = 'facebook.com/yourprofile';
}
});
$('#per_9').each(
function(i,el) {
if (!el.value || el.value == '') {
el.placeholder = 'twitter.com/yourprofile';
}
});
$('#per_11').each(
function(i,el) {
if (!el.value || el.value == '') {
el.placeholder = 'plus.google.com/yourprofile';
}
});
$('#per_13').each(
function(i,el) {
if (!el.value || el.value == '') {
el.placeholder = 'youtube.com/yourprofile';
}
});
$('#per_12').each(
function(i,el) {
if (!el.value || el.value == '') {
el.placeholder = 'instagram.com/yourprofile';
}
});
$('#per_7').each(
function(i,el) {
if (!el.value || el.value == '') {
el.placeholder = 'Profile Description (approx. 50 words) *';
}
});
$('#per_17').each(
function(i,el) {
if (!el.value || el.value == '') {
el.placeholder = 'Social Media Links (e.g. linkedin.com/yourprofile, twitter.com/yourprofile etc.)';
}
});
$('#discount_code').each(
function(i,el) {
if (!el.value || el.value == '') {
el.placeholder = 'Discount or Voucher Code';
}
});
/* Wrap Select in Label */
$('select').wrap('');
/* File Upload Requirements */
$('#l_per_14').html('Profile Picture *');
$(function () {
$('#per_14').on("change", function() {
$('#l_per_14 span').text($(this).val().split('\\').pop());
});
});
$('#l_per_18').html('Company Logo');
$(function () {
$('#per_18').on("change", function() {
$('#l_per_18 span').text($(this).val().split('\\').pop());
});
});
/* Change Please Select Option for Package */
$('#var_1 option:contains("* Please Select *")').text('Select Package *');
/* Show Premium Form Fields on Select */
$("#l_per_18, #per_18").hide();
$('#var_1').on('change',function(){
if( $(this).val()==="2"){
$("#l_per_18, #per_18").show()
}
else{
$("#l_per_18, #per_18").hide()
}
});
/* Wrap Checkbox for Styling */
$('').insertAfter('#terms');
$('#terms-label, #terms').wrapAll('');
/* Change Basket Button Text */
$("#basket_submit").html(' Checkout');
/* Scroll to Error Message on Order Form Error
$(document).ready(function () {
$('html, body').animate({
scrollTop: $('#paypal_form_error').offset().top - 110
}, 'slow');
}); */
/* Add Current Date */
var months = ['January','February','March','April','May','June','July',
'August','September','October','November','December'];
var tomorrow = new Date();
tomorrow.setTime(tomorrow.getTime() + (1000*3600*24));
document.getElementById("spandate").innerHTML = tomorrow.getFullYear();
/* Add Container Class to Contact Form & Product Page Containers */
$( "#form_21, #product_top, .product-listings, #related_products_list, #form_basket, #order_history, #product_description" ).addClass( "container" );
/* Product Page Requirements */
/* Add Order Now Div for Auto Scroll */
$('').prependTo('#product_info');
/* Change Product Price Text */
$('#product_price').contents().filter(function() {
return this.nodeType == 3
}).each(function(){
this.textContent = this.textContent.replace('Price from:','Get Started from just');
});
/* Add VAT Message Below Price */
$( '
To order your WAPPCard today please enter the information requested below. Our professional team will then have your own personalised digital business card live within 2 working days.
Please note: after the first 12 months, there is a yearly fee of €49 for the standard and premium packages. All prices are subject to VAT at 23%. All personal data herein are processed in accordance with EU data protection legislation. All feasible security measures are in place.
' ).insertAfter( '#product_price');
/* Wrap Images & Sharing Div in Column */
$('#product_images').wrap('');
/* Add Link to Example After Product Images */
$('
').prependTo('#product_images');
/* Add Col Class To Product Info & Images then Wrap in Row */
$('#image-col, #product_info').addClass("col-sm-10 col-sm-push-1 col-md-6 col-md-push-0").wrapAll('');
/* Wrap Product Images in Col */
$('#prod_sub_images > a').wrap('
');
/* Move Product Video Button To last Product Thumbnail Image */
$('.product-video-container').appendTo('#prod_sub_images > .sub-image-container:last-of-type > .sub-product-image-wrap');
/* Add Sale Ribbon To Pages with Discount */
$( '
Sale
' ).insertBefore( '#product_price_was' ).prependTo('#product_images');
/* Enable Colorbox Video */
$(document).ready(function(){
$(".popup-video").colorbox({iframe:true, innerWidth:800, innerHeight:450});
});
/* Colorbox Responsive Sizing */
jQuery.colorbox.settings.maxWidth = '90%';
jQuery.colorbox.settings.maxHeight = '90%';
// ColorBox resize function
var resizeTimer;
function resizeColorBox()
{
if (resizeTimer) clearTimeout(resizeTimer);
resizeTimer = setTimeout(function() {
if (jQuery('#cboxOverlay').is(':visible')) {
jQuery.colorbox.load(true);
}
}, 300);
}
// Resize ColorBox when resizing window or changing mobile device orientation
/* jQuery(window).resize(resizeColorBox); */
window.addEventListener("orientationchange", resizeColorBox, false);