$(document).ready(function(){
$('select').select2({
placeholder: "- - - wybierz z listy - - -",
allowClear: true,
maximumSelectionLength: 3,
"language": {
"formatSelectionTooBig": function (limit) {
return "Możesz wybrać maksymalnie 3 opcje.";
},
"noResults": function(){
return "Brak wyników";
}
}
});
$( "#datepicker" ).datepicker({
changeMonth: true,
changeYear: true,
yearRange: "-125:+0",
dateFormat: 'yy-mm-dd',
regional: [ "pl" ]
});
// slider główny
$('#slider-content').slick({
autoplay: true,
autoplaySpeed: 5000,
speed: 1700,
dots: false,
arrows: false,
pauseOnHover: false,
customPaging: function(){
return '';
},
});
$('#slider_guid-content').slick({
autoplay: true,
autoplaySpeed: 5000,
dots: true,
arrows: false,
pauseOnHover: false,
customPaging: function(){
return '';
},
});
$('.news_slider').slick({
autoplay: true,
autoplaySpeed: 5000,
dots: true,
arrows: false,
pauseOnHover: false,
customPaging: function(){
return '';
},
slidesToShow: 3,
slidesToScroll: 3,
responsive: [
{
breakpoint: 641,
settings:
{
slidesToShow: 2,
slidesToScroll: 2
}
},
{
breakpoint: 481,
settings:
{
slidesToShow: 1,
slidesToScroll: 1
},
}
]
});
$('#slider_guid_subpage-content').slick({
autoplay: true,
autoplaySpeed: 5000,
dots: false,
arrows: true,
pauseOnHover: false,
customPaging: function(){
return '';
},
prevArrow : '',
nextArrow : '',
});
$('#slider_guid_subpage-content').on('afterChange', function(event, slick, currentSlide, nextSlide)
{
var newHref = $(slick.$slides[currentSlide]).data('href');
$('#subpage_slider_guide .link').attr('href', newHref);
});
$('.news').click(function(){
var $this = $(this);
var $fulltext = $this.find('div.fulltext');
$fulltext.slideToggle('easy-in-out');
if ($(this).find('.news_link').html() == 'czytaj mniej') {
$(this).find('.news_link').html('czytaj więcej');
} else {
$(this).find('.news_link').html('czytaj mniej');
}
})
//Fancybox
$('.gallery a').fancybox({
showNavArrows: true,
cyclic: true,
});
window.addEventListener('resize', function(){
var menu = $("#menu");
var top_right = $('.top_right');
var hidden = $("body");
var content =$("#content");
var footer =$("footer");
var button = $("a.button");
var logo = $(".top_left");
if(window.innerWidth >=1140 )
{
top_right.removeClass('top_right_full');
logo.css("display", 'inline-block');
content.css("display", 'block');
footer.css("display", 'block');
hidden.css("overflow", 'inherit');
button.css("display", 'inline-block');
$("#nav-toggle").addClass('active');
menu.css('display', 'block');
} else
{
menu.slideUp();
$("#nav-toggle").removeClass('active');
}
}, true);
if(window.innerWidth <=1140 )
{
$('.footer_inner .title').click(function(){
$this = $(this);
$this.parent().parent().find('a.active').removeClass('active').next('ul').slideUp('fast', function(){
});
if ($this.hasClass('active'))
{
$this.removeClass('active');
$this.next('ul').slideUp('fast');
} else
{
$this.addClass('active');
$this.next('ul').slideDown('fast');
}
});
}
$( ".go_top" ).scrollTop();
//Rozwinięcie podczas wczytania
$('.left_submenu > li.active').find('ul').show();
//Rozwijanie po wczytaniu
$('.left_submenu > li').on('click touch',function(){
var other = $(this).siblings('.active');
other.find('ul').slideUp('fast', function(){ other.removeClass('active') });
if ($(this).hasClass('active'))
{
/* $(this).removeClass('active');
$(this).find('ul').slideUp('fast');*/
} else
{
$(this).addClass('active');
$(this).find('ul').slideDown('fast');
}
});
});
$(function () {
// document.querySelector("#nav-toggle").addEventListener("click", function () {
// this.classList.toggle("active");
// });
$("#nav-toggle").bind('click touch', function () {
var $this = $(this);
var menu = $("#menu");
var top_right = $('.top_right');
var hidden = $("body");
var content =$("#content");
var footer =$("footer");
var button = $("a.button");
var logo = $(".top_left");
if ($this.hasClass('active')) {
menu.slideUp('slow', function() {
top_right.css('position', 'relative');
top_right.removeClass('top_right_full');
logo.css("display", 'inline-block');
content.css("display", 'block');
footer.css("display", 'block');
$this.removeClass('active');
hidden.css("overflow", 'inherit');
button.css("display", 'inline-block');
});
} else {
menu.slideDown('slow');
top_right.addClass('top_right_full');
// top_right.css('position', 'fixed');
logo.css("display", 'none');
content.css("display", 'none');
footer.css("display", 'none');
menu.css("display", 'block')
$this.addClass('active');
hidden.css("overflow", 'hidden')
button.css("display", 'none')
}
return false;
});
if(window.innerWidth <=1140 )
{
$("#menu ul:first > li > a").bind('click touch', function () {
var $this = $(this);
var li = $this.parent();
var menu = $this.parent().find("ul");
var other = li.siblings('.active');
other.find('ul').slideUp('fast', function(){ other.removeClass('active') });
if (li.find('ul').length) {
if (li.hasClass('active'))
{
li.removeClass('active');
menu.slideUp('easy-in-out');
} else
{
li.addClass('active');
menu.slideDown('easy-in-out');
}
return false;
}
});
}
$('.newsletter_container form button, .newsletter_container a.signoff').on('click touch', function(e) {
e.preventDefault();
var form_vals = $(this).closest('form').serialize();
$.ajax({
url: "/ajax/newsletter.php?" + form_vals + "&action=" + $(this).data('action'),
}).done(function(data) {
$('.newsletter_container .text_green').html(data);
});
return false;
});
$('.go_top').on('click touch',function() {
$("html, body").animate({ scrollTop: 0 }, "slow");
return false;
});
$(window).bind('resize', function()
{
// ustawienie poczatkowych wartosci
if(!$('.offers a.arrow_down').attr('count'))
{
$('.offers a.arrow_up').attr('count', '0');
$('.offers a.arrow_down').attr('count', '5');
}
// ustawienie poczatkowej wysokosci
$(function()
{
var $height =0;
$('a.offer').slice(0,5).each(function(){
$height += $(this).outerHeight(true);
console.log( $(this).outerHeight(true))
})
$('.offers_window').css('height',$height );
});
$('.offers a.arrow_down').unbind('click touch').on('click touch', function() {
var $height =0;
$('a.offer').slice(
parseInt($('.offers a.arrow_up').attr('count')),
parseInt($('.offers a.arrow_down').attr('count'))
).each(function(){
$height += $(this).outerHeight(true);
console.log( $(this).outerHeight(true))
})
//$('.offers_window').css('height',$height );
if (parseInt($('.offers_box').css('top')) >= (-$('.offers_box').height() + $height)) {
$('.offers_box').animate({
top: "-=" +$height
});
$('.offers a.arrow_up').attr('count', parseInt($('.offers a.arrow_up').attr('count'))+5);
$('.offers a.arrow_down').attr('count', parseInt($('.offers a.arrow_down').attr('count'))+5);
$height =0;
$('a.offer').slice(
parseInt($('.offers a.arrow_up').attr('count')),
parseInt($('.offers a.arrow_down').attr('count'))
).each(function(){
$height += $(this).outerHeight(true);
console.log( $(this).outerHeight(true))
})
$('.offers_window').css('height',$height );
}
});
$('.offers a.arrow_up').unbind('click touch').on('click touch', function() {
var $height =0;
$('a.offer').slice(
parseInt($('.offers a.arrow_up').attr('count')),
parseInt($('.offers a.arrow_down').attr('count'))
).each(function(){
$height += $(this).outerHeight(true);
console.log( $(this).outerHeight(true))
})
//$('.offers_window').css('height',$height );
if (parseInt($('.offers_box').css('top')) <= -345 ) {
$('.offers a.arrow_up').attr('count', parseInt($('.offers a.arrow_up').attr('count'))-5);
$('.offers a.arrow_down').attr('count', parseInt($('.offers a.arrow_down').attr('count'))-5);
$height =0;
$('a.offer').slice(
parseInt($('.offers a.arrow_up').attr('count')),
parseInt($('.offers a.arrow_down').attr('count'))
).each(function(){
$height += $(this).outerHeight(true);
console.log( $(this).outerHeight(true))
})
$('.offers_window').css('height',$height );
$('.offers_box').animate({
top: "+=" + $height
});
}
});
}).trigger('resize');
});