var api = null; $(document).ready(function() { $('.event').on('mouseenter', function(ev) { $(this).find('div, a, h4').addClass('hovered'); }); $('.event').on('mouseleave', function(ev) { $(this).find('div, a, h4').removeClass('hovered'); }); var handleResize = function() { var h = $(window).height() - $('.timeline-content').css('borderTopWidth').replace('px', '') * 2; var w = $(window).width(); $('.jspContainer').height(h); $('#jscroll').height(h); if (api) { api.reinitialise(); } if (Wix.Utils.getDeviceType() != 'mobile'){ //console.log('//resize debounced Wix.setHeight('+$(window).height()+')' ); //Wix.setHeight($(window).height()); } else if (Wix.Utils.getDeviceType() == 'mobile'){ console.log('//resize debounced Wix.setHeight('+$('html').height()+')' ); Wix.setHeight($('html').height()); } }; $(window).on('resize', _.debounce(handleResize, 500)); $(window).on('resize', function() { console.log('//resize called '+$(window).height()+'' ); }); Wix.getBoundingRectAndOffsets(function(data) { var height = data.offsets.y + data.rect.height; var width = data.offsets.x + data.rect.width; Wix.resizeWindow(width, height); console.log('//Wix.resizeWindow('+width+', '+height+')'); }); var scrollHeight = $(window).height() - $('.timeline-content').css('borderTopWidth').replace('px', '') * 2/* - 20*/; //description fix for vertical-desktop style var widthFix = $('.widthFix'); if (widthFix.length > 0) { var width = $('#jscroll').width() / 2 - 200; $(widthFix).width(width); } $('.jspContainer').height($(window).height() - $('.timeline-content').css('borderTopWidth').replace('px', '') * 2); $('#jscroll').height(scrollHeight); $('body').on('click', '.photo-wrapper', function(ev) { var init = $(this); if (Wix.Utils.getDeviceType() == 'mobile') { var wh = $(window).height(); var ww = $(window).width(); Wix.openModal(init.data('href'), parseInt(ww), parseInt(wh), function () { }); } else { var wh = $(window).height() * 0.9; var ww = $(window).width() * 0.9; Wix.openModal(init.data('href'), parseInt(ww), parseInt(wh), function () { }); } }); setTimeout(function() { var _options = {}; if (typeof options !== 'undefined') { _options = options; } _options.showArrows = true; _options.arrowScrollOnHover = true; //_options.reinitialiseOnImageLoad = true; var scrollPane = $('#jscroll').jScrollPane(_options); api = scrollPane.data('jsp'); scrollPane.bind('mousewheel', function(event, delta, deltaY) { api.scrollByX(delta * -50); return false; }); }, 1000); Wix.addEventListener(Wix.Events.SETTINGS_UPDATED, function(data) { if (Number(data.borderWidth) >= 1) { $('.timeline-content').css('border-width', data.borderWidth).css('border-style', 'solid'); } $('.timeline-content').css('border-radius', data.borderRadius + 'px'); if (typeof data.eventForce !== 'undefined') { var event = $('.event' + data.eventForce); event.load('/get_event_content/' + data.eventForce + data.queryString); //matomai negauna vel _GET query_string_etc. } if (typeof data.id !== 'undefined') { var event = $('.event' + data.id); var importance = 2; if (typeof data.importance.value !== 'undefined') { importance = data.importance.value; } else { importance = data.importance + 1; } event.removeClass('event-1').removeClass('event-2').removeClass('event-3').addClass('event-' + importance); } }); });