; /* Start:"a:4:{s:4:"full";s:38:"/webfiles/js/history.js?16512577504502";s:6:"source";s:23:"/webfiles/js/history.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ $(document).ready(function(){ var innerMenu = new Swiper('.history_tabs .swiper-container', { slidesPerView: 'auto', direction: 'vertical', speed: 500, resistanceRatio: 0, // mousewheel: true, // slidesPerGroup: 10, navigation: { nextEl: '.history_tabs__down', }, breakpoints: { // when window width is <= 991px 991: { direction: 'horizontal', // mousewheel: false } } }); $('.history_tabs__item').each(function(){ $(this).attr('data-year', $(this).text().substr(-2)); }); function getSlideIndexByClass(className) { var index = 0; $.each($('.history_tabs__item'), function(i, item) { if ($(item).hasClass(className)) { index = i; return false; } }); return index; } function menuNav(item_id) { $('.history_tabs__item').removeClass('selected'); $('.history_tabs__item:contains('+ item_id +')').addClass('selected'); } $('.history_section').each(function(index) { var $current_section = $(this); var current_id = $current_section.attr('id'); $current_section.waypoint(function(direction) { if (direction === 'down'){ menuNav(current_id); innerMenu.slideTo(getSlideIndexByClass('selected')); } }, { offset: '60%' }); $current_section.waypoint(function(direction) { if (direction === 'up'){ menuNav(current_id); innerMenu.slideTo(getSlideIndexByClass('selected')); } }, { // offset: function() { // return window.innerHeight*0.6 - this.element.clientHeight; // } offset: 0 }); }); $('.history_tabs__item').click(function(){ var link_to = $(this).text(); $('html, body').animate({ scrollTop: $('#'+link_to).offset().top - 84 }, 750); }); var menu_waypoint = new Waypoint.Sticky({ element: $('.history_tabs')[0], handler: function(direction){ innerMenu.update(); } }); menuFix(); }); function menuFix(){ if( $('.history_tabs').height() >= ($('.history').height() + $('.history').offset().top - $(window).scrollTop()) ){ $('.history_tabs').addClass('position-bottom'); } else { $('.history_tabs').removeClass('position-bottom'); } } $(window).on('scroll orientationchange', menuFix); var lastScrollTop = 0; // curve animation var mask = document.getElementById("maskPath"); var curveDashed = document.getElementById("dashedPath"); var maskLength = mask.getTotalLength(); var dashedLength = curveDashed.getTotalLength(); mask.style.strokeDasharray = maskLength; mask.style.strokeDashoffset = maskLength; var curveSolid = document.getElementById("solidPath"); var solidLength = curveSolid.getTotalLength(); curveSolid.style.strokeDasharray = solidLength; curveSolid.style.strokeDashoffset = solidLength; var svg = document.querySelector('.history_curve'); var box = svg.viewBox.baseVal; $(window).on('scroll', function() { st = $(this).scrollTop(); if(st < lastScrollTop) { // up $('.history_tabs').removeClass('animation-in').addClass('animation-out'); } else { // down $('.history_tabs').addClass('animation-in').removeClass('animation-out'); } // curve animation var scrollpercent = 1.15 *(document.body.scrollTop + document.documentElement.scrollTop) / (document.documentElement.scrollHeight - document.documentElement.clientHeight); var drawDashed = dashedLength * scrollpercent; mask.style.strokeDashoffset = maskLength - drawDashed; var drawSolid = solidLength * scrollpercent; curveSolid.style.strokeDashoffset = solidLength - drawSolid; var zoomX = $('.history_curve').width()/box.width; var zoomY = $('.history_curve').height()/box.height; var pt = curveSolid.getPointAtLength(scrollpercent * solidLength); var p0 = curveSolid.getPointAtLength(solidLength); $('.history_point').css("transform", "translate("+ zoomX*(pt.x - 1.55*p0.x) + "px," + zoomY*pt.y + "px)"); }); /* End */ ;; /* /webfiles/js/history.js?16512577504502*/