$(document).ready(function() { $('#check-machu') .checkboxradio() .on('change', function(event){ checked = ($(this).is(':checked')); $('#calendar').find('.serv-box-machu').each(function(){ $(this).toggle(checked); }); }); $('#check-wayna') .checkboxradio() .on('change', function(event){ checked = ($(this).is(':checked')); $('#calendar').find('.serv-box-wayna').each(function(){ $(this).toggle(checked); }); }); $('#check-mountain') .checkboxradio() .on('change', function(event){ checked = ($(this).is(':checked')); $('#calendar').find('.serv-box-mountain').each(function(){ $(this).toggle(checked); }); }); $('#check-huchuy') .checkboxradio() .on('change', function(event){ checked = ($(this).is(':checked')); $('#calendar').find('.serv-box-huchuy').each(function(){ $(this).toggle(checked); }); }); $('#check-puente') .checkboxradio() .on('change', function(event){ checked = ($(this).is(':checked')); $('#calendar').find('.serv-box-puente').each(function(){ $(this).toggle(checked); }); }); var $wrap = $('#select-date').parent(); var frame = $('#select-date').sly({ horizontal: 1, itemNav: 'basic', smart: 1, activateMiddle: 1, activateOn: 'click', mouseDragging: 1, touchDragging: 1, releaseSwing: 1, startAt: 0, scrollBy: 1, pagesBar: $wrap.find('.pages'), speed: 300, elasticBounds: 1, easing: 'easeOutExpo', dragHandle: 1, dynamicHandle: 1, clickBar: 1, // Buttons prevPage: $(document).find('.prevPage'), prev: $(document).find('.prevWeek'), next: $(document).find('.nextWeek'), nextPage: $(document).find('.nextPage') },{ active: function(event, item) { $('#waiting-spin').fadeIn(200); var date = $(".select-date").eq(item).attr('data-date'); $.ajax({ url: 'display_calendar-ajax.php?date='+date, async: true, dataType: 'text', success: function(data) { $('#waiting-spin').fadeOut(20); $('#div-calendar').html(data); checked = ($('#check-machu').is(':checked')); $('#calendar').find('.serv-box-machu').each(function(){ $(this).toggle(checked); }); checked = ($('#check-wayna').is(':checked')); $('#calendar').find('.serv-box-wayna').each(function(){ $(this).toggle(checked); }); checked = ($('#check-mountain').is(':checked')); $('#calendar').find('.serv-box-mountain').each(function(){ $(this).toggle(checked); }); checked = ($('#check-huchuy').is(':checked')); $('#calendar').find('.serv-box-huchuy').each(function(){ $(this).toggle(checked); }); checked = ($('#check-puente').is(':checked')); $('#calendar').find('.serv-box-puente').each(function(){ $(this).toggle(checked); }); animateCounters(); $('.soldout').each(function() { $(this).parents('td').addClass('soldout'); }); } }); } }); $(document).find('.toStart').on('click', function () { frame.sly('toStart'); }); $(document).find('.toEnd').on('click', function () { frame.sly('toEnd'); }); /* $('#div-calendar').on('click', '.serv-status0', function() { //var serv = $(this).data('serv'); //var date = $(this).data('date'); var url = $(this).data('url'); window.location.href="/purchase-"+url+"#1"; }); */ var originalContent_subscribe; var window_subscribe = $('#popup-subscribe').dialog({ autoOpen: false, modal: true, position: { my: "top", at: "top", of: window }, width: 400, height: 'auto', resizable: false, title: "Subscription for the new season", buttons: {}, open : function(event, ui) { originalContent_subscribe = $("#popup-subscribe").html(); }, close: function (event, ui) { $('#popup-subscribe').html(originalContent_subscribe); } }).load('subscribe.php'); $('.ajax-popup-subscribe').click(function(event) { event.preventDefault(); window_subscribe.dialog('open'); }); //$('#div-calendar').on('click', '.day', function () { //$( "#div-calendar" ).on( "click", function( event ) { //$(document).on( "click", function( event ) { //$('#div-calendar').click(function(event) { //$('.essai').click(function(event) { $('.stats') .qtip({ //var date = $(this).data('date'); //var week = $(this).data('week'); //var qtip = $(this).qtip({ content: { text: "Loading...", title: { text: "Evolution of available spaces", button: "Close" }, ajax: { url: 'stats.php', method: 'GET', async: true, data: { //lg: 'en', week: 0 }, }, }, position: { my:'top center', at:'bottom center' }, show: 'click', hide: 'unfocus', style: { classes: 'ui-tooltip-popup ui-tooltip-shadow' } //}); }) .on('click', function () { event.preventDefault(); }); }); function animateCounters() { $('.spacesbox').each(function() { $(this).find('[class^="bar-"]').animate({ width: $(this).attr('data-pct') }, 2000); }); $('.spaces').each(function () { var spaces = $(this).data('spaces'); var spmax = $(this).data('max'); var nbDigits = (spmax+'').length; var nbDigits = 3; $(this).animate({ Counter: spaces }, { duration: 2000, easing: 'swing', step: function (now) { $(this).text(("000"+Math.ceil(now)).slice(-(nbDigits))); } }); }); }