$(window).load(function(){ $(".dot-wrapper").trigger("update.dot"); }); $(document).ready(function(){ $("#goto").change(function(){ if ($(this).val()!='') { window.location.href=$(this).val(); } }); $(".fancybox").jqPhotoSwipe({ galleryOpen: function (gallery) { //with `gallery` object you can access all methods and properties described here http://photoswipe.com/documentation/api.html //console.log(gallery); //console.log(gallery.currItem); //console.log(gallery.getCurrentIndex()); //gallery.zoomTo(1, {x:gallery.viewportSize.x/2,y:gallery.viewportSize.y/2}, 500); //gallery.toggleDesktopZoom(); } }); $('.flexslider').flexslider({ animation: "fade", autoplay: true, slideshowSpeed: 9000, animationSpeed: 2500, initDelay: 3500, randomize: false, pauseOnAction: true, pauseOnHover: true, touch: true }); $(".dot-wrapper").dotdotdot({ watch: "window" }); $('input#od, input#do').pickadate( { selectMonths: true, selectYears: true } ); // ošetřujeme lazy loading obrázků $( 'article img').not('img.banner').not('img.setmeup').each(function( index ) { var src = $( this ).attr('src'); //prepend '/' to the relative 'uc/' path if not already there var subSrc = src.substring(0,3); if(subSrc === 'uc/'){ var changedSrc = src.replace('uc/', '/uc/'); src = changedSrc; } $( this ).attr('data-original', src); $( this ).attr('src', '/ui/images/transparent.gif'); $( this ).removeClass( 'lazyload' ); $( this ).addClass( 'lazyload' ); }); $( 'img.lazyload' ).lazyload({ /*effect : "fadeIn"*/ }); $('.slick-news').slick({ slidesToShow: 3, slidesToScroll: 3, infinite: false, prevArrow: '', nextArrow: '', responsive: [ { breakpoint: 1024, settings: { slidesToShow: 3, slidesToScroll: 3, infinite: false, prevArrow: '', nextArrow: '', } }, { breakpoint: 860, /*settings: "unslick"*/ settings: { slidesToShow: 3, slidesToScroll: 3, infinite: false, prevArrow: '', nextArrow: '', } }, { breakpoint: 640, /*settings: "unslick"*/ settings: { slidesToShow: 2, slidesToScroll: 2, infinite: false, prevArrow: '', nextArrow: '' } }, { breakpoint: 480, settings: { slidesToShow: 1, slidesToScroll: 1, infinite: false, prevArrow: '', nextArrow: '' } } // You can unslick at a given breakpoint now by adding: // settings: "unslick" // instead of a settings object ] }); $("a.b-date-clear").on('click', function(event){ //prevent the default action for the click event event.preventDefault(); $(this).parent().parent().children('input#od').val(''); $(this).parent().children('input#do').val(''); }); $("a.b-date-clear.query").on('click', function(event){ //prevent the default action for the click event event.preventDefault(); $(this).parent().children('input#query').val(''); }); $("a.openMarker").on('click', function(event){ //prevent the default action for the click event event.preventDefault(); var id = $(this).attr('data-id'); var aTag = $("a[name='gMap']"); $('html,body').animate({scrollTop: aTag.offset().top}, 'slow', function () { if (id) { //console.log('bound click'); openMarker(id); } }); }); $.validate({ lang : 'pl', form : '#contact-form', modules : 'date, security', reCaptchaSiteKey: '6LfMhqkUAAAAAP1G4wrfMwPy_F7P78elXxPCDY_q', onModulesLoaded : function() { // alert('All modules loaded!'); }, onSuccess : function($form) { // alert('The form '+$form.attr('id')+' is valid!'); /*$.ajax({ type: "post", url: "/cs/poptavka-ubytovani/kontakt-form", data: $form.serialize(), timeout : 3000, success: function (data, text) { console.log(data); console.log(text); if (data != 'failed'){ $('#contact_form').html('

Váše poptávka byla úspěšně odeslána. Děkujeme. Brzy se vám ozveme (!).

'); }else{ alert('Poptávku se nepodařilo odeslat.'); } //console.log(data); //console.log(text); }, error: function (request, status, error) { console.log(request.responseText); //alert(request.responseText); $('#contact_form').html('

'+request.responseText+'

'); } });*/ event.preventDefault(); // No default action $.ajax({url: '/cs/poptavka-ubytovani/kontakt-form', type: 'post', data: $('#contact-form').serialize()}) .done(function (jsonData) { //if (jsonData['errors']) { if (jsonData['errors']) { //console.log(jsonData['errors']); //console.log(jsonData); $('#contact_form').html('

Je nám líto, ale Vaši objednávku se nepodařilo odeslat.

'+jsonData['errors']+'

'); } else { $('#contact_form').html('

Váše poptávka byla úspěšně odeslána. Děkujeme. Brzy se vám ozveme.

'); //console.log(jsonData); /*for (var key in jsonData) { $('#' + key).html(jsonData[key]); } // Distribute result into DIVs*/ } }) .fail(function () { $('#contact_form').append('FAILED'); }); /*});*/ return false; // Will stop the submission of the form }, onError : function($form) { //alert('The form '+$form.attr('id')+' is not-valid!'); return false; // Will stop the submission of the form }, }); }); function scrollToAnchor(aid){ var aTag = $("a[name='"+ aid +"']"); $('html,body').animate({scrollTop: aTag.offset().top},'slow'); }