1
0
mirror of https://github.com/ascribe/wp-theme synced 2024-12-23 01:30:09 +01:00
wp-theme/assets/_src/js/ascribe.js

109 lines
2.6 KiB
JavaScript
Raw Normal View History

//=include _dnt.js
//=include _faq.js
2015-09-24 08:24:34 +02:00
$(document).ready(function(){
2015-09-17 01:26:48 +02:00
if ( $('.subtemplate--faq').length ) {
Faq.init();
}
2015-09-25 07:55:31 +02:00
slider();
2015-10-16 05:27:03 +02:00
marketplaces();
tourNav();
2015-10-17 02:32:29 +02:00
mobileNav();
stickyNav();
2015-09-17 01:26:48 +02:00
2015-10-16 05:27:03 +02:00
function tourNav() {
2015-11-02 11:18:22 +01:00
if ($('body').hasClass('page-template-template-tour')) {
$('.tour-switcher .menu').prepend($('.tour-switcher .current-menu-item'));
}
2015-10-16 05:27:03 +02:00
$('.current-menu-item a').click(function(e){
e.preventDefault();
$('#menu-landing-page-menu').toggleClass('active');
});
}
2015-09-25 07:55:31 +02:00
function slider() {
$('.case-study:gt(0)').addClass('hidden');
2015-09-24 08:24:34 +02:00
2015-09-25 07:55:31 +02:00
$('.slider-action').click(function(){
2015-09-24 08:24:34 +02:00
2015-09-25 07:55:31 +02:00
var direction = $(this).attr('id');
2015-09-24 08:24:34 +02:00
2015-09-25 07:55:31 +02:00
if (direction === 'back') {
$('.case-study').addClass('hidden');
$('.case-study').last().prependTo('.slide-container').removeClass('hidden');
}
else {
displayed = $('.case-study').first();
displayed.addClass('hidden');
$('.case-study').eq(1).removeClass('hidden');
displayed.appendTo('.slide-container');
}
});
}
2016-03-12 16:12:07 +01:00
2015-10-16 05:27:03 +02:00
function marketplaces() {
$('.top-tab').click(function(){
$('.top-tab').removeClass('active');
$(this).addClass('active');
var contentToShow = $(this).data('tab');
$('.marketplace-info').removeClass('active');
$('#'+contentToShow).addClass('active');
});
}
2015-10-17 02:32:29 +02:00
2016-01-16 20:58:40 +01:00
});
2015-10-17 02:32:29 +02:00
2016-01-16 20:58:40 +01:00
function stickyNav() {
var sticky = $('.sticky');
$(window).on('load resize scroll', function() {
if ( $(window).width() > 768 ) {
if ( $(window).scrollTop() > 100 ) {
sticky.addClass('stuck');
} else {
sticky.removeClass('stuck');
2015-10-17 02:32:29 +02:00
}
2016-01-16 20:58:40 +01:00
}
});
}
2015-09-25 07:55:31 +02:00
2016-01-16 20:58:40 +01:00
function mobileNav() {
2016-02-02 22:12:40 +01:00
var hamburger = $('.hamburger'),
popup = $('.mobile-nav');
hamburger.click(function(e) {
e.preventDefault();
2016-02-02 22:12:40 +01:00
// toggle popup
popup.toggleClass('active');
hamburger.toggleClass('open');
2016-02-02 22:12:40 +01:00
// bind the hide controls
$(document).bind('click.hidepopup', function() {
// hide popup
popup.removeClass('active');
hamburger.removeClass('open');
2016-02-02 22:12:40 +01:00
// unbind the hide controls
$(document).unbind('click.hidepopup');
});
// dont close thepop when you click on thepop
popup.on('click', function(e) {
e.stopPropagation();
});
// and dont close thepop now
e.stopPropagation();
2016-01-16 20:58:40 +01:00
});
}