MediaWiki:Common.js: Difference between revisions

From Official Gamemode 4 Wiki
Jump to navigation Jump to search
(Added fancy hover)
(Shift weird crafting problem from Common.css to Common.js)
Line 21: Line 21:
         $('.tooltip').css({ top: mousey, left: mousex });
         $('.tooltip').css({ top: mousey, left: mousex });
     });
     });
  $('.crafting + p br:only-child').parent().hide();
});
});

Revision as of 00:24, 7 May 2020

/* Any JavaScript here will be loaded for all users on every page load. */

// Fency hovers for recipes
$(function() {
// Tooltip only Text
    $('.masterTooltip').hover(function(){
        // Hover over code
        var title = $(this).attr('title');
        $(this).data('tipText', title).removeAttr('title');
        $('<p class="tooltip">' + title + '</p>')
        //.text(title + "\n1")
        .appendTo('body')
        .show();
    }, function() {
        // Hover out code
        $(this).attr('title', $(this).data('tipText'));
        $('.tooltip').remove();
    }).mousemove(function(e) {
        var mousex = e.pageX + 20; //Get X coordinates
        var mousey = e.pageY - 40; //Get Y coordinates
        $('.tooltip').css({ top: mousey, left: mousex });
    });
   $('.crafting + p br:only-child').parent().hide();
});