Sha256: befed706bc7e42d40c0e5cbc0e6b98c4545dc1bdc49b63036986020aa31758f8
Contents?: true
Size: 1.57 KB
Versions: 6
Compression:
Stored size: 1.57 KB
Contents
// Vertical Scroll Sync {% include js/syncscroll.js %} window.conference.program = (function() { let updateHash = function (hash) { let scrollPosition = $('body').scrollTop() || $('html').scrollTop(); window.location.hash = hash; $('html,body').scrollTop(scrollPosition); }; let init = function () { if ($('#day-list')) { // Switch to day if page load with hash var hash = window.location.hash; if (hash) { $('#day-list a[href="' + hash + '"]').tab('show'); } // Switch to day if today else { let d = new Date(); let dStr = d.getFullYear() +"-"+ (d.getMonth()+1) +"-"+ d.getDate() // since a timezone compensation is added when passed as string, today's date has also // to be passed as string (as it is done below) let today = new Date(dStr); $('a[data-toggle="tab"]').each(function () { let d = new Date($(this).data('date')); if (today.getTime() === d.getTime()) { $(this).tab('show'); updateHash(this.hash); } }); } // Add current selected day as hash to URL while keeping current scrolling position $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { updateHash(this.hash); }); } }; return { init: init }; })(); window.conference.program.init();
Version data entries
6 entries across 6 versions & 1 rubygems