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

106 lines
2.8 KiB
JavaScript
Raw Normal View History

2015-09-24 08:24:34 +02:00
$(document).ready(function(){
2015-09-17 01:26:48 +02:00
2015-11-02 11:18:22 +01:00
imgAttrRemover();
2015-09-25 07:55:31 +02:00
slider();
featuredFAQ();
2015-10-16 05:27:03 +02:00
marketplaces();
tourNav();
2015-10-17 02:32:29 +02:00
mobileNav();
stickyNav();
colourHover();
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');
}
});
}
function featuredFAQ() {
$('.featured-faqs dt').click(function() {
$(this).next('dd').toggleClass('open');
});
}
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
function mobileNav() {
$('.hamburger').click(function(){
console.log('hi');
$('.mobile-nav').toggleClass('active');
});
}
function stickyNav() {
var didScroll = false;
var sticky = $('.sticky');
$(window).scroll(function () {
didScroll = true;
});
setInterval(function () {
if (didScroll) {
didScroll = false;
if ($(window).scrollTop() > 100) {
sticky.addClass('stuck');
}
else {
sticky.removeClass('stuck');
}
}
}, 250);
}
function colourHover() {
$('.team-member img').hover(
function(){
var hover = $(this).data('hover');
$(this).attr('src',hover);
},
function(){
var normal = $(this).data('regular');
$(this).attr('src',normal);
});
}
2015-11-02 11:18:22 +01:00
function imgAttrRemover() {
$('img').each(function(){
$(this).removeAttr('width');
$(this).removeAttr('height');
});
}
2015-09-25 07:55:31 +02:00
});
2015-09-24 08:24:34 +02:00