$(document).ready(function() {
/* ======= Scrollspy ======= */
$('body').scrollspy({ target: '#header', offset: 100});
/* ======= ScrollTo ======= */
$('a.scrollto').on('click', function(e){
//store hash
var target = this.hash;
e.preventDefault();
$('body').scrollTo(target, 800, {offset: -60, 'axis':'y'});
//Collapse mobile menu after clicking
if ($('.navbar-collapse').hasClass('in')){
$('.navbar-collapse').removeClass('in').addClass('collapse');
}
});
/* ======= Fixed Header animation ======= */
$(window).on('scroll load', function() {
if ($(window).scrollTop() > 0 ) {
$('#header').addClass('header-scrolled');
}
else {
$('#header').removeClass('header-scrolled');
}
});
/* ======= Vegas Plugin ======= */
if($('.promo-section-config').length > 0) {
var overlay_url = $('.promo-section-config p').html();
var images = [];
$('.promo-section-config ul li').each(function(){
images.push({src: $(this).html()});
});
/* Ref: http://vegas.jaysalvat.com/index.html */
$('#promo').vegas({
delay: 8000,
overlay: overlay_url,
color: '#101113',
transition: 'zoomOut',
transitionDuration: 3000,
slides: images
});
}
if($('.carousel-inner').length > 0) {
$(".carousel-inner .item").removeClass("show");
}
/*
// set the date we're counting down to
var target_date = new Date("Nov 20, 2016").getTime();
// variables for time units
var days, hours, minutes, seconds;
// get tag element
var countdown = document.getElementById("countdown-box");
var days_span = document.createElement("SPAN");
days_span.className = 'days';
countdown.appendChild(days_span);
var hours_span = document.createElement("SPAN");
hours_span.className = 'hours';
countdown.appendChild(hours_span);
var minutes_span = document.createElement("SPAN");
minutes_span.className = 'minutes';
countdown.appendChild(minutes_span);
var secs_span = document.createElement("SPAN");
secs_span.className = 'secs';
countdown.appendChild(secs_span);
// update the tag with id "countdown" every 1 second
setInterval(function () {
// find the amount of "seconds" between now and target
var current_date = new Date().getTime();
var seconds_left = (target_date - current_date) / 1000;
// do some time calculations
days = parseInt(seconds_left / 86400);
seconds_left = seconds_left % 86400;
hours = parseInt(seconds_left / 3600);
seconds_left = seconds_left % 3600;
minutes = parseInt(seconds_left / 60);
seconds = parseInt(seconds_left % 60);
// format countdown string + set tag value.
days_span.innerHTML = '' + days + '' + 'Days';
hours_span.innerHTML = '' + hours + '' + 'Hrs';
minutes_span.innerHTML = '' + minutes + '' + 'Mins';
secs_span.innerHTML = '' + seconds + '' + 'Secs';
}, 1000);
*/
//Instafeed.js - add Instagram photos to your website
//Ref: http://instafeedjs.com/#user
var loadButton = document.getElementById('load-more');
var userFeed = new Instafeed({
limit: 24,
get: 'user',
userId: 3265380287,
accessToken: '3265380287.1677ed0.df1daaf6cd6740c990d7d5d22b04d96d',
template: '
',
// every time we load more, run this function
after: function() {
// disable button if no more results to load
if (!this.hasNext()) {
loadButton.setAttribute('disabled', 'disabled');
}
}
});
// bind the load more button
loadButton.addEventListener('click', function() {
userFeed.next();
});
// run our feed!
userFeed.run();
/* ======= Play/Stop YouTube Video in Bootstrpa Modal ======= */
$('#video-play-triggger').on('click', function() {
var theModal = $(this).data("target");
var theVideo = $(theModal + ' iframe').attr('src');
var theVideoAuto = theVideo + "&autoplay=1";
$(theModal).on('shown.bs.modal', function () {
$(theModal + ' iframe').attr('src', theVideoAuto);
});
$(theModal).on('hide.bs.modal', function () {
$(theModal + ' iframe').attr('src', '');
});
$(theModal).on('hidden.bs.modal', function () {
$(theModal + ' iframe').attr('src', theVideo);
});
});
});