ernestophone.ens.fr/gestion/static/js/main.js

179 lines
3.6 KiB
JavaScript
Raw Normal View History

/*
Broadcast by TEMPLATED
templated.co @templatedco
Released for free under the Creative Commons Attribution 3.0 license (templated.co/license)
*/
(function($) {
skel.breakpoints({
xlarge: '(max-width: 1680px)',
large: '(max-width: 1280px)',
medium: '(max-width: 980px)',
small: '(max-width: 736px)',
xsmall: '(max-width: 480px)'
});
$(function() {
var $window = $(window),
$body = $('body');
// Disable animations/transitions until the page has loaded.
$body.addClass('is-loading');
$window.on('load', function() {
window.setTimeout(function() {
$body.removeClass('is-loading');
}, 100);
});
// Fix: Placeholder polyfill.
$('form').placeholder();
// Prioritize "important" elements on medium.
skel.on('+medium -medium', function() {
$.prioritize(
'.important\\28 medium\\29',
skel.breakpoint('medium').active
);
});
$('#id_multi_instrumentiste').on('change', function() {
if (this.value == 'Oui' ) {
$('#instru_bonus_field').show();
}
else {
$('#instru_bonus_field').hide();
}
});
$('#id_instru').on('change', function() {
if (this.value == 'Autre' ) {
$('#instru_autre_field').show();
}
else {
$('#instru_autre_field').hide();
}
});
$('#id_trombonoscope_colors').on('change', function() {
if (this.value == 'autre' ) {
$('#couleur_fond_field').show();
$('#couleur_text_field').show();
}
else {
$('#couleur_text_field').hide();
$('#couleur_fond_field').hide();
}
});
// Banner.
var $banner = $('#banner');
if ($banner.length > 0) {
// IE fix.
if (skel.vars.IEVersion < 12) {
$window.on('resize', function() {
var wh = $window.height() * 0.60,
bh = $banner.height();
$banner.css('height', 'auto');
window.setTimeout(function() {
if (bh < wh)
$banner.css('height', wh + 'px');
}, 0);
});
$window.on('load', function() {
$window.triggerHandler('resize');
});
}
// Video check.
var video = $banner.data('video');
if (video)
$window.on('load.banner', function() {
// Disable banner load event (so it doesn't fire again).
$window.off('load.banner');
// Append video if supported.
if (!skel.vars.mobile
&& !skel.breakpoint('large').active
&& skel.vars.IEVersion > 9)
$banner.append('<video autoplay loop muted><source src="' + video + '.mp4" type="video/mp4" /><source src="' + video + '.webm" type="video/webm" /></video>');
});
// More button.
$banner.find('.more')
.addClass('scrolly');
}
// Tabbed Boxes
$('.flex-tabs').each( function() {
var t = jQuery(this),
tab = t.find('.tab-list li a'),
tabs = t.find('.tab');
tab.click(function(e) {
var x = jQuery(this),
y = x.data('tab');
// Set Classes on Tabs
tab.removeClass('active');
x.addClass('active');
// Show/Hide Tab Content
tabs.removeClass('active');
t.find('.' + y).addClass('active');
e.preventDefault();
});
});
// Scrolly.
if ( $( ".scrolly" ).length ) {
var $height = $('#header').height();
$('.scrolly').scrolly({
offset: $height
});
}
});
})(jQuery);