$(document).ready(function () { dropdownFooterMenu(); showShareOptions(); goToTop(); }); function dropdownFooterMenu () { $('.o-footer').find('.collapse-button').on('click', function (event) { event.preventDefault(); if ($(window).width() < 767) { $(this).toggleClass('collapsed'); $(this).closest('.panel').find('.panel-collapse').collapse('toggle'); } }); } function showShareOptions () { $('.o-footer').find('.share_options_link--button').on('click', function (event) { event.preventDefault(); }); $('.o-footer').find('.share_options_link--button').popover({ html: true, placement: 'top', content: function () { return $('#share_options_popover').html(); } }); $(document).on('click', function (event) { $('.o-footer').find('.share_options_link--button').each(function () { if (!$(this).is(event.target) && $(this).has(event.target).length === 0 && $('.popover').has(event.target).length === 0) { $(this).popover('hide').data('bs.popover').inState.click = false; // fix for BS 3.3.6 } }); }); } function goToTop () { $('.to-top-button').on('click', function (event) { event.preventDefault(); if ($('html').length) { $('html, body').animate({ scrollTop: $('html').offset().top }, 650); } }); }