function myFunction(popupid) { $('.popuptext').each(function() { if(popupid != $(this).attr('id')){ $(this).removeClass('show');} }); var popup = document.getElementById(popupid); popup.classList.toggle("show"); } function toggleGyik(elem){ jQuery(function($){ if($(elem).hasClass('opened')){ $(elem).siblings('.gyik_box_content').slideUp(); $(elem).removeClass("opened"); }else{ $(elem).siblings('.gyik_box_content').slideDown(); $(elem).addClass("opened"); } }); } jQuery(function($){ var moveTrigger = undefined; var router = document.getElementById("inwb_router_default"); /*function initStartRouter(){ if (moveTrigger == undefined) { if (matchMedia("(min-width: 769px) and (max-width: 1152px)").matches) { router.style.transform = 'translate(110px, 208px)'; router.setAttribute('data-x', 110); router.setAttribute('data-y', 208); }else if (matchMedia("(min-width: 1px) and (max-width: 768px)").matches) { router.style.transform = 'translate(193px, 208px)'; router.setAttribute('data-x', 193); router.setAttribute('data-y', 208); }else{ router.style.transform = 'translate(77px, 208px)'; router.setAttribute('data-x', 77); router.setAttribute('data-y', 208); } } }*/ function dragMoveListener (event) { if (moveTrigger == undefined) { router.classList = ["inwb_router"]; //$("#inwb_arrow_default").hide(); } var target = event.target; var x = (parseFloat(target.getAttribute('data-x')) || 0) + event.dx; var y = (parseFloat(target.getAttribute('data-y')) || 0) + event.dy; target.style.webkitTransform = target.style.transform = 'translate(' + x + 'px, ' + y + 'px)'; target.setAttribute('data-x', x); target.setAttribute('data-y', y); } interact('.inwb_router').draggable({ inertia: true, modifiers: [ interact.modifiers.restrictRect({ restriction: 'parent', }) ], listeners: { move: dragMoveListener, end (event) { if (moveTrigger == undefined) { moveTrigger = setTimeout(function() { $("#inwb_wifiextra_app_text").html("Van megoldás! Szabad a gazda?"); $("#inwb_wifiextra_app_btn").css("display","flex"); }, 250) } } } }) //initStartRouter(); const PIXEL_STEP = 10; const LINE_HEIGHT = 40; const PAGE_HEIGHT = 800; function normalizeWheel(event) { var sX = 0, sY = 0, pX = 0, pY = 0; if ('detail' in event) { sY = event.detail; } if ('wheelDelta' in event) { sY = -event.wheelDelta / 120; } if ('wheelDeltaY' in event) { sY = -event.wheelDeltaY / 120; } if ('wheelDeltaX' in event) { sX = -event.wheelDeltaX / 60; } if ( 'axis' in event && event.axis === event.HORIZONTAL_AXIS ) { sX = sY; sY = 0; } pX = sX * PIXEL_STEP; pY = sY * PIXEL_STEP; if ('deltaY' in event) { pY = event.deltaY; } if ('deltaX' in event) { pX = event.deltaX; } if ((pX || pY) && event.deltaMode) { if (event.deltaMode == 1) { pX *= LINE_HEIGHT; pY *= LINE_HEIGHT; } else { pX *= PAGE_HEIGHT; pY *= PAGE_HEIGHT; } } if (pX && !sX) { sX = (pX < 1) ? -1 : 1; } if (pY && !sY) { sY = (pY < 1) ? -1 : 1; } return { spinX : sX, spinY : sY, pixelX : pX, pixelY : pY }; } $(document).ready(function(){ /*$(function(){ $("#container1").twentytwenty(); });*/ let inwb_card_carousel = $('.devices_carousel'); inwb_card_carousel.slick({ arrows: false, dots: false, infinite: false, slidesToShow: 3, slidesToScroll: 1, variableWidth: true, responsive: [ { breakpoint: 1150, settings: { slidesToShow: 2, dots: true, variableWidth: true, } }, { breakpoint: 880, settings: { slidesToShow: 1, dots: true, variableWidth: true, } }, ] }); let inwb_testimonials_carousel = $('#inwb_testimonials_carousel'); inwb_testimonials_carousel.slick({ arrows: true, appendArrows: $("#inwb_testimonials_carousel_inner_cont"), dots: false, slidesToShow: 4, slidesToScroll: 1, infinite: false, speed: 200, responsive: [ { breakpoint: 1280, settings: { slidesToShow: 3, } }, { breakpoint: 990, settings: { slidesToShow: 2, } }, { breakpoint: 576, settings: { slidesToShow: 1, arrows: false, dots: true, } }, ] }); inwb_testimonials_carousel.on('beforeChange', function(event, slick, currentSlide, nextSlide){ curr_ratio = nextSlide / slick.slideCount; iW = $(".indicator").width(); $( ".scrollbar" ).animate({ left: iW * curr_ratio, }, slick.options.speed - 100, function() { }); }); let optWidth = $("#inwb_testimonials_carousel_cont .indicator").width(); $(".indicator").css({ "width": optWidth }); $(".scrollbar").css({ "width": optWidth / inwb_testimonials_carousel.slick("getSlick").slideCount * inwb_testimonials_carousel.get(0).slick.options.slidesToShow }); delete $(".scrollbar").draggable; $(".scrollbar").draggable({ axis: "x", containment: ".indicator", scroll: false }); delete $(".scrollbar").on; $(".scrollbar").on("dragstart", function (event, ui) { window.scrollDragging = true; }); $(".scrollbar").on("dragstop", function (event, ui) { window.scrollDragging = false; iW = $(".indicator").width(); sW = $(".scrollbar").width(); palcikaRatio = iW - sW; palcikaPosition = $(".scrollbar").position().left / palcikaRatio; if (palcikaPosition < 0.01) palcikaPosition = 0; if (palcikaPosition > 0.99) palcikaPosition = 1; newPos = ($("#inwb_testimonials_carousel .slick-track").width() - iW) * palcikaPosition; slider_width = $(".slick-slide").width(); stepCount = Math.round(newPos / slider_width); inwb_testimonials_carousel.slick('slickGoTo', stepCount, false); }); $(".scrollbar").on("drag", function (event, ui) { iW = $(".indicator").width(); sW = $(".scrollbar").width(); palcikaRatio = iW - sW; palcikaPosition = $(".scrollbar").position().left / palcikaRatio; if (palcikaPosition < 0.01) palcikaPosition = 0; if (palcikaPosition > 0.99) palcikaPosition = 1; newPos = ($("#inwb_testimonials_carousel .slick-track").width() - iW) * palcikaPosition; $("#inwb_testimonials_carousel .slick-track").css('transform','translate3d(-' + newPos + 'px, 0px, 0px)'); }); var scrolling = false; var oldTime = 0; var newTime = 0; var isTouchPad; var eventCount = 0; var eventCountStart; var resetNeeded = false; inwb_testimonials_carousel.on('wheel', (function(evt) { evt.preventDefault(); if (new Date().getTime() - eventCountStart > 2000 && !resetNeeded) { resetNeeded = true; eventCount = 0; } var isTouchPadDefined = isTouchPad || typeof isTouchPad !== "undefined"; if (!isTouchPadDefined) { if (eventCount === 0) { eventCountStart = new Date().getTime(); } eventCount++; if (new Date().getTime() - eventCountStart > 100) { if (eventCount > 5) { isTouchPad = true; } else { isTouchPad = false; } isTouchPadDefined = true; } } if (resetNeeded) { if (eventCount === 0) { eventCountStart = new Date().getTime(); } eventCount++; if (new Date().getTime() - eventCountStart > 100) { if (eventCount > 5) { isTouchPad = true; } else { isTouchPad = false; } isTouchPadDefined = true; resetNeeded = false; } } if (isTouchPadDefined) { if (!evt) evt = event; normalized_values = normalizeWheel(evt.originalEvent); if (isTouchPad) { newTime = new Date().getTime(); if (!scrolling && newTime-oldTime > 300 ) { scrolling = true; if (normalized_values.spinY < 0 || normalized_values.pixelY < 0 || normalized_values.spinX < 0 || normalized_values.pixelX < 0 ) { $(this).slick('slickPrev'); } else if (normalized_values.spinY > 0 || normalized_values.pixelY > 0 || normalized_values.spinX > 0 || normalized_values.pixelX > 0 ){ $(this).slick('slickNext'); } setTimeout(function() {oldTime = new Date().getTime();scrolling = false}, 200); } } else { if (normalized_values.spinY < 0 || normalized_values.pixelY < 0 || normalized_values.spinX < 0 || normalized_values.pixelX < 0 ) { $(this).slick('slickPrev'); } else if (normalized_values.spinY > 0 || normalized_values.pixelY > 0 || normalized_values.spinX > 0 || normalized_values.pixelX > 0 ){ $(this).slick('slickNext'); } } } })); $(window).resize(function () { //initStartRouter(); optWidth = $("#inwb_testimonials_carousel_inner_cont").width(); $(".indicator").css({ "width": optWidth }); $(".scrollbar").css({ "width": optWidth / inwb_testimonials_carousel.slick("getSlick").slideCount * inwb_testimonials_carousel.get(0).slick.options.slidesToShow }); }); //$("#container1").twentytwenty(); $("#container1").imagesLoaded( function() { $("#container1").twentytwenty(); }); /*$(window).on('load', function () { $("#container1").twentytwenty(); });*/ }); });