Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | $(function () { var $window = $(window) , $top_link = $('#toplink') , $body = $('body, html') , offset = $('#code').offset().top; $top_link.hide().click(function (event) { event.preventDefault(); $body.animate({scrollTop: 0}, 800); }); $window.scroll(function () { if ($window.scrollTop() > offset) { $top_link.fadeIn(); } else { $top_link.fadeOut(); } }); var $popovers = $('.popin > :first-child'); $('.popin').on({ 'click.popover': function (event) { event.stopPropagation(); var $container = $(this).children().first(); //Close all other popovers: $popovers.each(function () { var $current = $(this); if (!$current.is($container)) { $current.popover('hide'); } }); // Toggle this popover: $container.popover('toggle'); }, }); //Hide all popovers on outside click: $(document).click(function (event) { if ($(event.target).closest($('.popover')).length === 0) { $popovers.popover('hide'); } }); //Hide all popovers on escape: $(document).keyup(function (event) { if (event.key === 'Escape') { $popovers.popover('hide'); } }); }); |