Module:Sandbox/LVL: Difference between revisionsGive feedback
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 526: | Line 526: | ||
-- First column in each row is hero name. Make it sticky to the left for horizontal scrolling. | -- First column in each row is hero name. Make it sticky to the left for horizontal scrolling. | ||
-- | -- Explicit background-color prevents scrolling content from showing through. z-index helps with stacking. | ||
row_str = row_str .. '<td style="position: sticky; left: 0; background-color: #ffffff; z-index: 1;">' .. hero_icon .. "</td>" | |||
-- Consecutive columns are then stats | -- Consecutive columns are then stats | ||
| Line 595: | Line 594: | ||
-- First header is Hero. The top-left corner cell needs to be sticky in both directions. | -- First header is Hero. The top-left corner cell needs to be sticky in both directions. | ||
-- z-index: 2 ensures it's on top of other sticky cells. | -- z-index: 2 ensures it's on top of other sticky cells. Background color matches standard wikitable headers. | ||
local | local headers_str = '<th style="position: sticky; top: 0; left: 0; z-index: 2; background-color: #eaecf0;">' .. "Hero" .. "</th>" | ||
local category_data = attribute_module.get_category_data() | local category_data = attribute_module.get_category_data() | ||
local postfix | local postfix | ||
| Line 617: | Line 614: | ||
-- Iterate stats again for displaying headers with their respective color | -- Iterate stats again for displaying headers with their respective color | ||
for _, category in ipairs(attribute_orders["category_order"]) do | for _, category in ipairs(attribute_orders["category_order"]) do | ||
category_attrs = attributes_data[category] | local category_attrs = attributes_data[category] | ||
category_rgb = category_data[category]["rgb"] | local category_rgb = category_data[category]["rgb"] | ||
-- Iterate attributes within the category | -- Iterate attributes within the category | ||
if (stats_to_include[category] ~= nil) then | if (stats_to_include[category] ~= nil) then | ||
-- Define style once per category for efficiency | |||
local header_style = ' style="position: sticky; top: 0; z-index: 1; background-color: rgb(' .. category_rgb .. ');"' | |||
for _, attr_key in ipairs(stats_to_include[category]) do | for _, attr_key in ipairs(stats_to_include[category]) do | ||
attr_data = category_attrs[attr_key] | local attr_data = category_attrs[attr_key] | ||
local attr_localized | |||
if (attr_data ~= nil) then | if (attr_data ~= nil) then | ||
| Line 647: | Line 648: | ||
end | end | ||
end | end | ||
headers_str = headers_str .. "<th" .. header_style .. ">" .. attr_localized .. postfix .. "</th>" | headers_str = headers_str .. "<th" .. header_style .. ">" .. attr_localized .. postfix .. "</th>" | ||