(function() { $.fn.smoothScroll = function(options) { var defaultOptions = { speed: 500, easing: 'easeOutExpo' }; options = $.extend({}, defaultOptions, options || {}); return this.each(function() { $(this).on('click',function() { var href = $(this).attr('href'); var target = $(href === '#' || href === '' ? 'html' : href); var pos = target.offset().top; $('body,html').animate({ scrollTop : pos }, { duration: options.speed, easing: 'swing' }); return false; }); }); }; $(function() { // google analytics event tracking //$('[data-eventlabel]').each(function() { // var label = $(this).attr('data-eventlabel'); // $(this).on('click', function() { // if (('ga' in window) && label !== '') { // window.ga('send', 'event', 'dscanner_promotion', 'click', label); // } // }); //}); $('.rollover').each(function(_, image) { var src = image.src; $(image).hover(function() { image.src = src.replace(/_off\./, '_on.'); }, function() { image.src = src.replace(/_on\./, '_off.'); }); }); $('.js-smoothscroll').smoothScroll(); $('.current-year').each(function() { var thisyear = (new Date()).getFullYear(); $(this).text(thisyear); }); }); }());