Difference between revisions of "User:Wookipan/Sandbox/Page.js"

From Team Fortress Wiki
Jump to: navigation, search
(Created page with "var wikiTooltip = { init: function() { var $tooltips = $('#tooltip .tooltip-content'); if ($tooltips[0]) { $tooltips.each(function() {...")
 
m (Change selectors in accordance with elements)
Line 1: Line 1:
 
var wikiTooltip = {
 
var wikiTooltip = {
 
     init: function() {
 
     init: function() {
         var $tooltips = $('#tooltip .tooltip-content');
+
         var $tooltips = $('.wiki-tooltip .wiki-tooltip-content');
 
          
 
          
 
         if ($tooltips[0]) {
 
         if ($tooltips[0]) {

Revision as of 14:20, 2 September 2023

var wikiTooltip = {
    init: function() {
        var $tooltips = $('.wiki-tooltip .wiki-tooltip-content');
        
        if ($tooltips[0]) {
            $tooltips.each(function() {
                var $this = $(this);
                
                edgeRect = $this.width() + $this.offset().left;
                widthRect = $(window).width();
                if (edgeRect - widthRect > $this.width()*0) {
                    $this.css('left', '');
                    $this.css('right', '10px');
                }
            });
        }
    }
};
$(wikiTooltip.init);