sterntours/src/AppBundle/Resources/public/js/custom.js
Kevin Adametz 45150780de Startseiten-CMS-Anbindung abschließen
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-28 15:04:21 +00:00

736 lines
No EOL
23 KiB
JavaScript

var is_mobile_collapse = false;
if(jQuery(document).width() < 992){
is_mobile_collapse = true;
}
var collapse_status = 'mobile';
var collapse_on_responsive = function() {
if (is_mobile_collapse) {
if(collapse_status !== 'mobile'){
collapse_status = 'mobile';
//close
//jQuery('.widget').find('.collapse-widget:not(.open)').addClass('collapsed');
//jQuery('.widget').find('.collapse:not(.open)').removeClass('in');
}else{
//first init mobile - open
//jQuery('.widget').find('.collapse-widget.open').removeClass('collapsed');
//jQuery('.widget').find('.collapse.open').addClass('in');
}
}else{
if(collapse_status !== 'desktop') {
collapse_status = 'desktop';
jQuery('.widget').find('.collapse-widget').removeClass('collapsed');
jQuery('.widget').find('.collapse').addClass('in');
}
}
};
collapse_on_responsive();
$(window).on('resize',function(){
// collapse_on_responsive();
});
$(document).ready(function() {
function scrollToTabContent(tabSelector){
$("html, body").animate({
scrollTop: $(tabSelector).offset().top - 220
}, 1000);
}
function activateTravelDatesTab(){
$('[href=\'#travel-dates-content-tab\']').first().on('shown.bs.tab', function () {
scrollToTabContent('#travel-dates-content-tab');
});
$('[href=\'#travel-dates-content-tab\']').first().tab('show');
}
$('.nav-tabs > li > a').click(function(){
if($(this).data('toggle') === 'tab'){
return
}
scrollToTabContent($(this).attr('href'));
});
$('#st-slider-booking-events-scroll').click(function (event) {
event.preventDefault();
activateTravelDatesTab();
});
if (location.hash === '#travel-dates-content-tab'){
activateTravelDatesTab();
}
});
window.currentScroll = 0;
jQuery('body').removeClass('no-js');
// Initialize library to lazy load images
var observer = lozad('.lozad', {
threshold: 0.1,
});
observer.observe();
jQuery("button.btn-mobile").bind("click", function(e) {
e.preventDefault();
jQuery(this).toggleClass('btn-mobile-active');
jQuery('html').removeClass('noscroll');
jQuery('#menu-overlay').remove();
if(jQuery(this).hasClass('btn-mobile-active')) {
jQuery('body').append('<div id="menu-overlay"></div>');
if(!jQuery(".topMain").hasClass('nav-onepage') || window.width > 960) { /* onepage fix */
jQuery('html').addClass('noscroll');
window.currentScroll = jQuery(window).scrollTop();
}
} else {
if(!jQuery(".topMain").hasClass('nav-onepage') || window.width > 960) { /* onepage fix */
jQuery('html,body').animate({scrollTop: currentScroll}, 300, 'easeInOutExpo');
}
}
});
var addActiveClass = false;
jQuery(".topMain a.dropdown-toggle").bind("click", function(e) {
if(jQuery("button.btn-mobile").hasClass('btn-mobile-active') || jQuery("html").hasClass('touch')){
e.preventDefault();
}
addActiveClass = jQuery(this).parent().hasClass("resp-active");
jQuery(".topMain").find(".resp-active").removeClass("resp-active");
if(!addActiveClass) {
jQuery(this).parents("li").addClass("resp-active");
}
return true;
});
jQuery(document).ready(function($) {
"use strict";
/* ==============================================
KEYWORDS -->
=============================================== */
var modal$ = $('#st-default-modal');
$('a.show-layer').click(function() {
$.get($(this).attr('href')).then(function(r) {
modal$.find('.modal-body').html(r);
modal$.find('a[data-type="youtube"]').on('click', function () {
if (typeof youtube_loader === 'function') {
youtube_loader(this);
}
});
modal$.find('img.lozad').each(function () {
$(this).attr('src', $(this).data('src'));
});
modal$.find('iframe.lozad').each(function () {
$(this).attr('src', $(this).data('src'));
});
modal$.find('a.keyword-link').each(function () {
$(this).replaceWith($(this).text());
});
modal$.modal('show');
});
return false;
});
/* ==============================================
SIDEBAR BOX SLIDER -->
=============================================== */
function createSlider(ctx$, interval)
{
if (!interval)
{
interval = 0;
}
function setSlideInterval()
{
if (interval <= 0)
{
return;
}
if(slideInterval)
{
clearInterval(slideInterval);
}
slideInterval = setInterval(function() {
jumpToNextSlide();
}, interval);
}
function jumpToNextSlide()
{
setActiveSlide(slideIndex === slideCount - 1 ? 0 : slideIndex + 1);
setSlideInterval();
}
function setActiveSlide(newIndex)
{
slide$s[slideIndex].removeClass('active');
slideIndex = newIndex;
slide$s[slideIndex].addClass('active');
}
var slides$ = $('.slide', ctx$);
var slideCount = slides$.length;
if(slideCount > 1)
{
var slideInterval;
var slide$s = [];
for(var i = 0; i < slideCount; ++i)
{
slide$s.push($(slides$.get(i)));
}
var slideIndex = 0;
setSlideInterval();
$('.item-button-next', ctx$).click(function() {
jumpToNextSlide();
});
$('.item-button-prev', ctx$).click(function() {
setActiveSlide(slideIndex === 0 ? slideCount - 1 : slideIndex - 1);
setSlideInterval();
});
}
}
$('.box-slider').each(function() {
createSlider($(this));
});
/* ==============================================
MENU HOVER -->
=============================================== */
if($(window).width() > 768){
$(".header .navbar-nav .dropdown:not(.openClick)").hover(
function() {
$(".dropdown.openClick").removeClass('open');
$('.dropdown-menu', this).stop( true, true ).slideDown("fast");
$('.bootstrap-select.open').removeClass('open');
$(this).toggleClass('open');
},
function() {
$('.dropdown-menu', this).stop( true, true ).slideUp("fast");
$(this).toggleClass('open');
}
);
$(".header .dropdown:not(.openClick) .nav-first-a").click(
function ()
{
if($(window).width() > 768){
window.location.href = $(this).attr('href');
}
}
);
}
$('.selectpicker').selectpicker({
dropupAuto: false
});
/* ==============================================
nav-tabs -->
=============================================== */
$('.nav-tabs li a').click(function (e) {
//get selected href
var href = $(this).attr('href');
//set all nav tabs to inactive
$('.nav-tabs li').removeClass('active');
//get all nav tabs matching the href and set to active
$('.nav-tabs li a[href="'+href+'"]').closest('li').addClass('active');
//active tab
$('.tab-pane').removeClass('active');
$('.tab-pane'+href).addClass('active');
if($('#position-scroll-tab').length){
$('html, body').animate({
scrollTop: ($("#position-scroll-tab").offset().top - 220)
}, 500);
}
});
/* ==============================================
tooltip -->
=============================================== */
$(function () {
$('[data-toggle="tooltip"]').tooltip()
});
jQuery(document).ready(function($) {
$('article img.img-responsive').each(function( index ) {
$(this).hover(function () {
// Hover over code
var title = $(this).attr('title');
$(this).data('tipText', title);
$('<p class="stooltip"></p>').text(title).appendTo('body').fadeIn('slow');
}, function () {
// Hover out code
$(this).attr('alt', $(this).data('tipText'));
$('.stooltip').remove();
}).mousemove(function (e) {
var mousex = e.pageX + 20;
//Get X coordinates
var mousey = e.pageY + 10;
//Get Y coordinates
$('.stooltip').css({
top: mousey,
left: mousex
})
});
});
});
/* ==============================================
ACCORDION -->
=============================================== */
function toggleChevron(e) {
var $i = $(e.target)
.parent('.panel-group')
.find("i.indicator");
$i.toggleClass('icon-minus icon-plus');
if($i.hasClass('icon-minus')){
$i.parent('h3').find('span').html('Reiseleistungen ausblenden');
}
if($i.hasClass('icon-plus')){
$i.parent('h3').find('span').html('Reiseleistungen einblenden');
}
}
$('#accordion').on('hidden.bs.collapse', toggleChevron);
$('#accordion').on('shown.bs.collapse', toggleChevron);
function toggleChevron2(e) {
var $i = $(e.target)
.parent('.panel-group')
.find("i.indicator");
$i.toggleClass('icon-minus icon-plus');
if($i.hasClass('icon-minus')){
$i.parent('h3').find('span').html('Reiseablauf mit Reisetagen ausblenden');
}
if($i.hasClass('icon-plus')){
$i.parent('h3').find('span').html('Reiseablauf mit Reisetagen einblenden');
}
}
$('#accordion_pd').on('hidden.bs.collapse', toggleChevron2);
$('#accordion_pd').on('shown.bs.collapse', toggleChevron2);
function toggleChevron3(e) {
var $i = $(e.target)
.parent('.panel-group')
.find("i.indicator");
$i.toggleClass('icon-minus icon-plus');
if($i.hasClass('icon-minus')){
$i.parent('h3').find('span').html('Flugdaten ausblenden');
}
if($i.hasClass('icon-plus')){
$i.parent('h3').find('span').html('Flugdaten einblenden');
}
}
$('#accordion_fd').on('hidden.bs.collapse', toggleChevron3);
$('#accordion_fd').on('shown.bs.collapse', toggleChevron3);
/* ==============================================
carousel -->
=============================================== */
$('.carousel').carousel({
interval: 5000, //changes the speed
});
/* ==============================================
OWL CAROUSEL -->
=============================================== */
function loadOwlCarouselBackgrounds(ctx$) {
$('.lozad[data-background-image]', ctx$).each(function () {
var image$ = $(this);
var backgroundImage = image$.attr('data-background-image');
if (backgroundImage) {
image$.css('background-image', 'url("' + backgroundImage + '")');
}
});
}
var owlFullwidth$ = $('.owl-fullwidth');
owlFullwidth$.on('initialized.owl.carousel translated.owl.carousel refreshed.owl.carousel', function () {
loadOwlCarouselBackgrounds($(this));
});
var owl = owlFullwidth$.owlCarousel({
loop:true,
margin:0,
nav:true,
dots:false,
navText: [
"<i class='fa fa-angle-right'></i>",
"<i class='fa fa-angle-left'></i>"],
responsive:{
0:{
items:1
},
600:{
items:2
},
1000:{
items:3
}
},
});
loadOwlCarouselBackgrounds(owlFullwidth$);
/* ==============================================
BOX LINK -->
=============================================== */
$('.get-box-link').click(function() {
var el$ = $(this);
var url = el$.find('.is-box-link').attr('href');
if (el$.attr('target') === '_blank')
{
window.open(url);
}
else
{
location.href = url;
}
return false;
});
/* ==============================================
DATEPICKER -->
=============================================== */
$(".datepicker").each(function(){
var windowW = $(window).width();
if(windowW <= 768){
$(this).attr('readonly', 'true');
}
});
$( ".datepicker" ).datepicker({
dateFormat: 'dd.mm.yy', prevText: '&#x3c;zurück', prevStatus: '',
prevJumpText: '&#x3c;&#x3c;', prevJumpStatus: '',
nextText: 'Vor&#x3e;', nextStatus: '',
nextJumpText: '&#x3e;&#x3e;', nextJumpStatus: '',
currentText: 'heute', currentStatus: '',
todayText: 'heute', todayStatus: '',
clearText: '-', clearStatus: '',
closeText: 'schließen', closeStatus: '',
monthNames: ['Januar','Februar','März','April','Mai','Juni',
'Juli','August','September','Oktober','November','Dezember'],
monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun',
'Jul','Aug','Sep','Okt','Nov','Dez'],
dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
firstDay: 1,
beforeShowDay: function(date) {
var allowedDateStrListStr = $(this).attr('data-allowed-dates');
if (allowedDateStrListStr)
{
var allowedDatesStrList = allowedDateStrListStr.split(';');
for (var i = 0; i < allowedDatesStrList.length; ++i)
{
var allowedDate = new Date(allowedDatesStrList[i]);
if (allowedDate.getDate() === date.getDate() && allowedDate.getMonth() === date.getMonth() &&
allowedDate.getYear() === date.getYear())
{
return [true, '', ''];
}
}
return [false, '', '']
}
return [true, '', ''];
}
});
function initAutoEndDate(startTxt$, endTxt$)
{
startTxt$.add(endTxt$).change(function() {
var startDate = startTxt$.datepicker('getDate');
if (startDate > endTxt$.datepicker('getDate'))
{
endTxt$.datepicker('setDate', new Date(startDate.getFullYear(), startDate.getMonth(),
startDate.getDate() + 14));
}
});
}
var ttSearchForm$ = $('.st-tt-search-form');
if (ttSearchForm$.length)
{
initAutoEndDate(ttSearchForm$.find('[name=termin]'), ttSearchForm$.find('[name=ruecktermin]'));
}
var searchForm$ = $('.st-search-form');
if (searchForm$.length)
{
initAutoEndDate(searchForm$.find('[name=b]'), searchForm$.find('[name=e]'));
}
});
$("a.scroll-to-jump").click(function(e)
{
$(window).trigger('resize');
e.preventDefault();
var aid = $(this).attr('href');
aid = aid.replace("#", "");
aTag = $("[id='"+ aid +"']");
if(aTag !== null && aTag.offset() !== null){
$("html, body").animate({
scrollTop: aTag.offset().top - 220
}, 1000);
}
}
);
function initGoTo() {
//Variables
if(!$('.js-go-to').length){
return;
}
var $this = $('.js-go-to'),
$target = $this.data('target'),
showEffect = $this.data('show-effect'),
position = $this.data('position'),
type = $this.data('type'),
hideEffect = $this.data('hide-effect'),
offsetTop = $this.data('offset-top'),
targetOffsetTop = function () {
return $target ? $($target).offset().top : 0;
};
if (type == 'static') {
$this.css({
'display': 'inline-block'
});
} else {
$this.addClass('animated').css({
'display': 'inline-block',
'position': type,
'opacity': 0
});
}
if (type == 'fixed' || type == 'absolute') {
$this.css(position);
}
$this.on('click', function (e) {
e.preventDefault();
$('html, body').stop().animate({
'scrollTop': targetOffsetTop()
}, 800);
});
if (!$this.data('offset-top') && !$this.hasClass('js-animation-was-fired') && type != 'static') {
if ($this.offset().top <= $(window).height()) {
$this.show();
setTimeout(function () {
$this.addClass('js-animation-was-fired ' + showEffect).css({
'opacity': ''
});
});
}
}
if (type != 'static') {
$(window).on('scroll', function () {
if ($this.data('offset-top')) {
if ($(window).scrollTop() >= offsetTop && !$this.hasClass('js-animation-was-fired')) {
$this.show();
setTimeout(function () {
$this.addClass('js-animation-was-fired ' + showEffect).css({
'opacity': ''
});
});
} else if ($(window).scrollTop() <= offsetTop && $this.hasClass('js-animation-was-fired')) {
$this.removeClass('js-animation-was-fired ' + showEffect);
setTimeout(function () {
$this.addClass(hideEffect).css({
'opacity': 0
});
}, 100);
setTimeout(function () {
$this.removeClass(hideEffect).hide();
}, 400);
}
} else {
var thisOffsetTop = $this.offset().top;
if (!$this.hasClass('js-animation-was-fired')) {
if ($(window).scrollTop() >= thisOffsetTop - $(window).height()) {
$this.show();
setTimeout(function () {
$this.addClass('js-animation-was-fired ' + showEffect).css({
'opacity': ''
});
});
}
}
}
});
$(window).trigger('scroll');
}
}
initGoTo();
$(document).ready(function() {
$('.st-booking-form').validator().on('submit', function (e) {
if (e.isDefaultPrevented()) {
$(".btn-booking-form .alert-danger").removeClass("hide");
$(".btn-booking-form .alert-danger").addClass("show");
} else {
$(".btn-booking-form .alert-danger").removeClass("hide");
$(".btn-booking-form .alert-danger").addClass("show");
$(".btn-booking-form").attr("disabled", true);
$(".btn-booking-form .btn-booking-submit").addClass("hide");
$(".btn-booking-form .btn-booking-loading").removeClass("hide");
}
});
$(".st-booking-form")
.validator()
.on("submit", function (t) {
(t.isDefaultPrevented(),
$(".btn-booking-form .alert-danger").removeClass("hide"),
$(".btn-booking-form .alert-danger").addClass("show")) ||
($(".btn-booking-form .alert-danger").removeClass("show"),
$(".btn-booking-form .alert-danger").addClass(""),
$(".btn-booking-form").attr("disabled", !0),
$(".btn-booking-form .btn-booking-submit").addClass("hide"),
$(".btn-booking-form .btn-booking-loading").removeClass("hide"));
});
var $topNavAccordion = $('#topNavAccordion');
$topNavAccordion.on('show.bs.collapse','.collapse', function() {
$topNavAccordion.find('.collapse.in').collapse('hide');
});
//Author
$('.article').find('.author_name').each(function(){
$(this).on('mouseover', function(){
$(this).next().addClass('show').show(100);
});
$(this).on('mouseout', function(){
$(this).next().removeClass('show').hide(50);
});
$(this).on('click', function(){
if($(this).next().hasClass('show')){
$(this).next().removeClass('show').hide(50);
}else{
$(this).next().addClass('show').show(100);
}
});
});
// STICKY
if($('#header').hasClass('sticky')) {
var _header_el = $('#header');
var _topBar_H = $("#topBar").outerHeight() || 0;
var _mobile_info_effect = false;
var windowWidht = jQuery(document).width();
// Force fixed header on mobile to avoid "jump" effect
if(windowWidht<= 992 && _topBar_H < 1) {
var _scrollTop = $(document).scrollTop();
var _header_H = _header_el.outerHeight() || 0;
_header_el.addClass('fixed');
$('body').css({"padding-top":_header_H+"px"});
}
if(windowWidht <= 786){
window.scroll(0, _topBar_H);
_mobile_info_effect = true;
}
$('.btn-mobile-info').on('click', function(){
jQuery('html,body').animate({scrollTop: 0}, 300, 'easeInOutExpo');
});
$(window).scroll(function() {
_topBar_H = $("#topBar").outerHeight() || 0;
if((windowWidht > 992 && _topBar_H < 1) || _topBar_H > 0) { // 992 to disable on mobile
var _scrollTop = $(document).scrollTop();
if(_scrollTop > _topBar_H) {
_header_el.addClass('fixed');
var _header_H = _header_el.outerHeight() || 0;
$('body').css({"padding-top":_header_H+"px"});
} else {
$('body').css({"padding-top":"0px"});
_header_el.removeClass('fixed');
}
if(_mobile_info_effect){
if(_scrollTop <= 0){
setTimeout(function () {
$('.btn-mobile-info').removeClass('my_fadein').addClass('my_fadeout');
}, 100);
}else{
setTimeout(function () {
$('.btn-mobile-info').removeClass('my_fadeout').addClass('my_fadein');
}, 100);
}
}
}
});
}
if (document.getElementById("marquee")) {
var laufschrift = document.getElementById("marquee");
len = laufschrift.innerHTML.length;
laufschrift.firstChild.style.animationDuration = len/6 +"s";
}
});