Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Replacement for snote_init()
- $(window).load(function () {
- $('.snote').toggleClass("snote snote_tip").each(function(index) {
- $(this).before('<span class="snote_refnum">[' + $(this).attr('title') + ']</span>');
- });
- });
- // Replacement for snote_hide and snote_show
- $(document).on('click', function(event) {
- // Handle clicks on snote_refnum's
- if (event.target.className == 'snote_refnum') {
- // Get the snote_tip adjacent to the snote_refnum
- var thisSnoteTip = $(event.target).nextAll('.snote_tip').eq(0);
- // Toggle the visibility state of the snote_tip
- if (thisSnoteTip.css("visibility") == 'hidden') {
- thisSnoteTip.css("visibility","visible");
- }
- else {
- thisSnoteTip.css("visibility","hidden");
- }
- // If the click wasn't on a number, determine whether the click was on an element (such as a link) inside the tip
- // Trigger if we click outside the tip, or on the tip itself, but not on items inside the tip
- } else if (event.target.className == 'snote_tip' || !$(event.target).closest('.snote_tip').length) {
- // Hide all tooltips
- $('.snote_tip').css("visibility","hidden");
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement